# coding: utf-8

"""
    ThingsBoard REST API

     ThingsBoard Professional Edition IoT platform REST API documentation.  # noqa: E501

    OpenAPI spec version: 3.7.0PE
    Contact: info@thingsboard.io
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""

#  Copyright 2024. ThingsBoard
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES 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 'deleteLatest' to delete latest value (stored in separate table for performance) if the value's timestamp matches the time-range.  Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) if the value's timestamp matches the time-range and 'deleteLatest' param is true. The replacement value will be fetched from the 'time-series' table, and its timestamp will be the most recent one before the defined 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 delete_latest: If the parameter is set to true, the latest telemetry can be removed, otherwise, in case that parameter is set to false the latest value will not removed.
        :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 'deleteLatest' to delete latest value (stored in separate table for performance) if the value's timestamp matches the time-range.  Use 'rewriteLatestIfDeleted' to rewrite latest value (stored in separate table for performance) if the value's timestamp matches the time-range and 'deleteLatest' param is true. The replacement value will be fetched from the 'time-series' table, and its timestamp will be the most recent one before the defined 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 delete_latest: If the parameter is set to true, the latest telemetry can be removed, otherwise, in case that parameter is set to false the latest value will not removed.
        :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', 'delete_latest', '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 'delete_latest' in params:
            query_params.append(('deleteLatest', params['delete_latest']))  # 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,deleteLatest,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 str interval_type: A string value representing the type fo the interval.
        :param int interval: A long value representing the aggregation interval range in milliseconds.
        :param str time_zone: A string value representing the timezone that will be used to calculate exact timestamps for 'WEEK', 'WEEK_ISO', 'MONTH' and 'QUARTER' interval types.
        :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 str interval_type: A string value representing the type fo the interval.
        :param int interval: A long value representing the aggregation interval range in milliseconds.
        :param str time_zone: A string value representing the timezone that will be used to calculate exact timestamps for 'WEEK', 'WEEK_ISO', 'MONTH' and 'QUARTER' interval types.
        :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_type', 'interval', 'time_zone', '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_type' in params:
            query_params.append(('intervalType', params['interval_type']))  # noqa: E501
        if 'interval' in params:
            query_params.append(('interval', params['interval']))  # noqa: E501
        if 'time_zone' in params:
            query_params.append(('timeZone', params['time_zone']))  # 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,intervalType,keys,limit,orderBy,startTs,timeZone,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)
