# coding: utf-8

"""
    IoT服务

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)  # noqa: E501

    The version of the OpenAPI document: 1.0.0
    Generated by: https://openapi-generator.tech
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from dhicn_iot_service.api_client import ApiClient
from dhicn_iot_service.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class TelemetryApi(object):
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None):
        if api_client is None:
            api_client = ApiClient()
        self.api_client = api_client

    def api_v1_iot_latest_timeseries_post(self, **kwargs):  # noqa: E501
        """根据指标获取最新实测数据，要求指标编码再系统中是唯一的  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_latest_timeseries_post(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param LatestTimeSeriesInput latest_time_series_input:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: list[LatestTimeSeriesOutput]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_iot_latest_timeseries_post_with_http_info(**kwargs)  # noqa: E501

    def api_v1_iot_latest_timeseries_post_with_http_info(self, **kwargs):  # noqa: E501
        """根据指标获取最新实测数据，要求指标编码再系统中是唯一的  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_latest_timeseries_post_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param LatestTimeSeriesInput latest_time_series_input:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[LatestTimeSeriesOutput], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'latest_time_series_input'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_iot_latest_timeseries_post" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'latest_time_series_input' in local_var_params:
            body_params = local_var_params['latest_time_series_input']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/iot/latest-timeseries', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[LatestTimeSeriesOutput]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v1_iot_query_online_processed_timeseries_get(self, device_id, keys, start_ts, end_ts, **kwargs):  # noqa: E501
        """查询设备指标的时间序列数据 Query time-series data of device indicators  # noqa: E501

        查询设备多个指标在某个时间段内的时间序列数据 Query time-series data of multiple indicators of a device by time.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_query_online_processed_timeseries_get(device_id, keys, start_ts, end_ts, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str device_id: 设备ID device id (required)
        :param list[str] keys: 指标列表 indicators (required)
        :param str start_ts: 查询开始时间 start time (required)
        :param str end_ts: 查询结束时间 end time (required)
        :param str order_by: 排序方式，ASC (升序)，DESC (降序) sort order, ASC (ASCENDING) or DESC (DESCENDING);默认是降序DESC
        :param int interval:
        :param str agg:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: dict(str, list[object])
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_iot_query_online_processed_timeseries_get_with_http_info(device_id, keys, start_ts, end_ts, **kwargs)  # noqa: E501

    def api_v1_iot_query_online_processed_timeseries_get_with_http_info(self, device_id, keys, start_ts, end_ts, **kwargs):  # noqa: E501
        """查询设备指标的时间序列数据 Query time-series data of device indicators  # noqa: E501

        查询设备多个指标在某个时间段内的时间序列数据 Query time-series data of multiple indicators of a device by time.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_query_online_processed_timeseries_get_with_http_info(device_id, keys, start_ts, end_ts, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str device_id: 设备ID device id (required)
        :param list[str] keys: 指标列表 indicators (required)
        :param str start_ts: 查询开始时间 start time (required)
        :param str end_ts: 查询结束时间 end time (required)
        :param str order_by: 排序方式，ASC (升序)，DESC (降序) sort order, ASC (ASCENDING) or DESC (DESCENDING);默认是降序DESC
        :param int interval:
        :param str agg:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(dict(str, list[object]), status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'device_id',
            'keys',
            'start_ts',
            'end_ts',
            'order_by',
            'interval',
            'agg'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_iot_query_online_processed_timeseries_get" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'device_id' is set
        if self.api_client.client_side_validation and ('device_id' not in local_var_params or  # noqa: E501
                                                        local_var_params['device_id'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `device_id` when calling `api_v1_iot_query_online_processed_timeseries_get`")  # noqa: E501
        # verify the required parameter 'keys' is set
        if self.api_client.client_side_validation and ('keys' not in local_var_params or  # noqa: E501
                                                        local_var_params['keys'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `keys` when calling `api_v1_iot_query_online_processed_timeseries_get`")  # noqa: E501
        # verify the required parameter 'start_ts' is set
        if self.api_client.client_side_validation and ('start_ts' not in local_var_params or  # noqa: E501
                                                        local_var_params['start_ts'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `start_ts` when calling `api_v1_iot_query_online_processed_timeseries_get`")  # noqa: E501
        # verify the required parameter 'end_ts' is set
        if self.api_client.client_side_validation and ('end_ts' not in local_var_params or  # noqa: E501
                                                        local_var_params['end_ts'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `end_ts` when calling `api_v1_iot_query_online_processed_timeseries_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'device_id' in local_var_params and local_var_params['device_id'] is not None:  # noqa: E501
            query_params.append(('DeviceId', local_var_params['device_id']))  # noqa: E501
        if 'keys' in local_var_params and local_var_params['keys'] is not None:  # noqa: E501
            query_params.append(('Keys', local_var_params['keys']))  # noqa: E501
            collection_formats['Keys'] = 'multi'  # noqa: E501
        if 'start_ts' in local_var_params and local_var_params['start_ts'] is not None:  # noqa: E501
            query_params.append(('StartTs', local_var_params['start_ts']))  # noqa: E501
        if 'end_ts' in local_var_params and local_var_params['end_ts'] is not None:  # noqa: E501
            query_params.append(('EndTs', local_var_params['end_ts']))  # noqa: E501
        if 'order_by' in local_var_params and local_var_params['order_by'] is not None:  # noqa: E501
            query_params.append(('OrderBy', local_var_params['order_by']))  # noqa: E501
        if 'interval' in local_var_params and local_var_params['interval'] is not None:  # noqa: E501
            query_params.append(('Interval', local_var_params['interval']))  # noqa: E501
        if 'agg' in local_var_params and local_var_params['agg'] is not None:  # noqa: E501
            query_params.append(('Agg', local_var_params['agg']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/iot/query-online-processed-timeseries', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, list[object])',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v1_iot_save_telemetry_data_batch_post(self, **kwargs):  # noqa: E501
        """批量保存或更新时间序列数据 Batch save or update time-series data  # noqa: E501

        批量保存或更新设备指标的时间序列数据，时间序列数据以json格式传递 Batch save or update device indicator time-series data, data is transferred in the format of json.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_save_telemetry_data_batch_post(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[SaveTelemetryDataInput] save_telemetry_data_input:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_iot_save_telemetry_data_batch_post_with_http_info(**kwargs)  # noqa: E501

    def api_v1_iot_save_telemetry_data_batch_post_with_http_info(self, **kwargs):  # noqa: E501
        """批量保存或更新时间序列数据 Batch save or update time-series data  # noqa: E501

        批量保存或更新设备指标的时间序列数据，时间序列数据以json格式传递 Batch save or update device indicator time-series data, data is transferred in the format of json.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_save_telemetry_data_batch_post_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[SaveTelemetryDataInput] save_telemetry_data_input:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(object, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'save_telemetry_data_input'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_iot_save_telemetry_data_batch_post" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'save_telemetry_data_input' in local_var_params:
            body_params = local_var_params['save_telemetry_data_input']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/iot/save-telemetry-data-batch', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='object',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v1_iot_save_telemetry_data_post(self, **kwargs):  # noqa: E501
        """保存或更新时间序列数据 Save or update time-series data  # noqa: E501

        保存或更新设备指标的时间序列数据，时间序列数据以json格式传递 Save or update device indicator time-series data, data is transferred in the format of json.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_save_telemetry_data_post(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param SaveTelemetryDataInput save_telemetry_data_input:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_iot_save_telemetry_data_post_with_http_info(**kwargs)  # noqa: E501

    def api_v1_iot_save_telemetry_data_post_with_http_info(self, **kwargs):  # noqa: E501
        """保存或更新时间序列数据 Save or update time-series data  # noqa: E501

        保存或更新设备指标的时间序列数据，时间序列数据以json格式传递 Save or update device indicator time-series data, data is transferred in the format of json.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_save_telemetry_data_post_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param SaveTelemetryDataInput save_telemetry_data_input:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(object, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'save_telemetry_data_input'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_iot_save_telemetry_data_post" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'save_telemetry_data_input' in local_var_params:
            body_params = local_var_params['save_telemetry_data_input']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/iot/save-telemetry-data', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='object',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v1_iot_timeseries_batch_post(self, **kwargs):  # noqa: E501
        """批量查询设备指标的时间序列数据，按时间排序 Batch query time-series data of device indicators order by time  # noqa: E501

        批量查询设备多个指标在某个时间段内的时间序列数据，可按时间排序 Batch query time-series data of multiple indicators of a device by time and order by time.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_timeseries_batch_post(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[TimeseriesInput] timeseries_input:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: list[dict(str, list[object])]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_iot_timeseries_batch_post_with_http_info(**kwargs)  # noqa: E501

    def api_v1_iot_timeseries_batch_post_with_http_info(self, **kwargs):  # noqa: E501
        """批量查询设备指标的时间序列数据，按时间排序 Batch query time-series data of device indicators order by time  # noqa: E501

        批量查询设备多个指标在某个时间段内的时间序列数据，可按时间排序 Batch query time-series data of multiple indicators of a device by time and order by time.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_timeseries_batch_post_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[TimeseriesInput] timeseries_input:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[dict(str, list[object])], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'timeseries_input'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_iot_timeseries_batch_post" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'timeseries_input' in local_var_params:
            body_params = local_var_params['timeseries_input']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/iot/timeseries-batch', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[dict(str, list[object])]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v1_iot_timeseries_get(self, device_id, keys, start_ts, end_ts, **kwargs):  # noqa: E501
        """查询设备指标的时间序列数据，按时间排序 Query time-series data of device indicators order by time  # noqa: E501

        查询设备多个指标在某个时间段内的时间序列数据，可按时间排序 Query time-series data of multiple indicators of a device by time and order by time.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_timeseries_get(device_id, keys, start_ts, end_ts, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str device_id: 设备ID device id (required)
        :param list[str] keys: 指标列表 indicators (required)
        :param str start_ts: 查询开始时间 start time (required)
        :param str end_ts: 查询结束时间 end time (required)
        :param str order_by: 排序方式，ASC (升序)，DESC (降序) sort order, ASC (ASCENDING) or DESC (DESCENDING);默认是降序DESC
        :param int interval:
        :param str agg:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: dict(str, list[object])
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v1_iot_timeseries_get_with_http_info(device_id, keys, start_ts, end_ts, **kwargs)  # noqa: E501

    def api_v1_iot_timeseries_get_with_http_info(self, device_id, keys, start_ts, end_ts, **kwargs):  # noqa: E501
        """查询设备指标的时间序列数据，按时间排序 Query time-series data of device indicators order by time  # noqa: E501

        查询设备多个指标在某个时间段内的时间序列数据，可按时间排序 Query time-series data of multiple indicators of a device by time and order by time.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v1_iot_timeseries_get_with_http_info(device_id, keys, start_ts, end_ts, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str device_id: 设备ID device id (required)
        :param list[str] keys: 指标列表 indicators (required)
        :param str start_ts: 查询开始时间 start time (required)
        :param str end_ts: 查询结束时间 end time (required)
        :param str order_by: 排序方式，ASC (升序)，DESC (降序) sort order, ASC (ASCENDING) or DESC (DESCENDING);默认是降序DESC
        :param int interval:
        :param str agg:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(dict(str, list[object]), status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'device_id',
            'keys',
            'start_ts',
            'end_ts',
            'order_by',
            'interval',
            'agg'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v1_iot_timeseries_get" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'device_id' is set
        if self.api_client.client_side_validation and ('device_id' not in local_var_params or  # noqa: E501
                                                        local_var_params['device_id'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `device_id` when calling `api_v1_iot_timeseries_get`")  # noqa: E501
        # verify the required parameter 'keys' is set
        if self.api_client.client_side_validation and ('keys' not in local_var_params or  # noqa: E501
                                                        local_var_params['keys'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `keys` when calling `api_v1_iot_timeseries_get`")  # noqa: E501
        # verify the required parameter 'start_ts' is set
        if self.api_client.client_side_validation and ('start_ts' not in local_var_params or  # noqa: E501
                                                        local_var_params['start_ts'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `start_ts` when calling `api_v1_iot_timeseries_get`")  # noqa: E501
        # verify the required parameter 'end_ts' is set
        if self.api_client.client_side_validation and ('end_ts' not in local_var_params or  # noqa: E501
                                                        local_var_params['end_ts'] is None):  # noqa: E501
            raise ApiValueError("Missing the required parameter `end_ts` when calling `api_v1_iot_timeseries_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'device_id' in local_var_params and local_var_params['device_id'] is not None:  # noqa: E501
            query_params.append(('DeviceId', local_var_params['device_id']))  # noqa: E501
        if 'keys' in local_var_params and local_var_params['keys'] is not None:  # noqa: E501
            query_params.append(('Keys', local_var_params['keys']))  # noqa: E501
            collection_formats['Keys'] = 'multi'  # noqa: E501
        if 'start_ts' in local_var_params and local_var_params['start_ts'] is not None:  # noqa: E501
            query_params.append(('StartTs', local_var_params['start_ts']))  # noqa: E501
        if 'end_ts' in local_var_params and local_var_params['end_ts'] is not None:  # noqa: E501
            query_params.append(('EndTs', local_var_params['end_ts']))  # noqa: E501
        if 'order_by' in local_var_params and local_var_params['order_by'] is not None:  # noqa: E501
            query_params.append(('OrderBy', local_var_params['order_by']))  # noqa: E501
        if 'interval' in local_var_params and local_var_params['interval'] is not None:  # noqa: E501
            query_params.append(('Interval', local_var_params['interval']))  # noqa: E501
        if 'agg' in local_var_params and local_var_params['agg'] is not None:  # noqa: E501
            query_params.append(('Agg', local_var_params['agg']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v1/iot/timeseries', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='dict(str, list[object])',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v2_iot_timeseries_batch_post(self, **kwargs):  # noqa: E501
        """批量查询多个设备指标的时间序列数据，按时间排序 Batch query time-series data of device indicators order by time  # noqa: E501

        批量查询多个设备指标在某个时间段内的时间序列数据，可按时间排序,返回的tspair结构为：[{T,V},{T,V}]. Batch query time-series data of multiple device indicators by time and order by time,return data structure:[{T,V},{T,V}]  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v2_iot_timeseries_batch_post(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[TimeseriesInput] timeseries_input:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: list[TimeseriesBatchOutput]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v2_iot_timeseries_batch_post_with_http_info(**kwargs)  # noqa: E501

    def api_v2_iot_timeseries_batch_post_with_http_info(self, **kwargs):  # noqa: E501
        """批量查询多个设备指标的时间序列数据，按时间排序 Batch query time-series data of device indicators order by time  # noqa: E501

        批量查询多个设备指标在某个时间段内的时间序列数据，可按时间排序,返回的tspair结构为：[{T,V},{T,V}]. Batch query time-series data of multiple device indicators by time and order by time,return data structure:[{T,V},{T,V}]  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v2_iot_timeseries_batch_post_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[TimeseriesInput] timeseries_input:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[TimeseriesBatchOutput], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'timeseries_input'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v2_iot_timeseries_batch_post" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'timeseries_input' in local_var_params:
            body_params = local_var_params['timeseries_input']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v2/iot/timeseries-batch', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[TimeseriesBatchOutput]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v3_iot_save_telemetry_data_batch_post(self, **kwargs):  # noqa: E501
        """以结构化的数据格式批量保存或更新实测数据 / Save or update measured data in batches in a structured data format  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v3_iot_save_telemetry_data_batch_post(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[SaveTelemetryStructDataBatchInput] save_telemetry_struct_data_batch_input:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v3_iot_save_telemetry_data_batch_post_with_http_info(**kwargs)  # noqa: E501

    def api_v3_iot_save_telemetry_data_batch_post_with_http_info(self, **kwargs):  # noqa: E501
        """以结构化的数据格式批量保存或更新实测数据 / Save or update measured data in batches in a structured data format  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v3_iot_save_telemetry_data_batch_post_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[SaveTelemetryStructDataBatchInput] save_telemetry_struct_data_batch_input:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(object, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'save_telemetry_struct_data_batch_input'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v3_iot_save_telemetry_data_batch_post" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'save_telemetry_struct_data_batch_input' in local_var_params:
            body_params = local_var_params['save_telemetry_struct_data_batch_input']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v3/iot/save-telemetry-data-batch', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='object',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def api_v3_iot_timeseries_batch_post(self, **kwargs):  # noqa: E501
        """根据指标获取实测时序数据,返回的tspair结构为：T[],V[]. Batch query time-series data of multiple device indicators by time and order by time,return data structure:T[],V[]  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v3_iot_timeseries_batch_post(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[TimeseriesBatchForV3Input] timeseries_batch_for_v3_input:
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: list[TimeseriesBatchForV3Output]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.api_v3_iot_timeseries_batch_post_with_http_info(**kwargs)  # noqa: E501

    def api_v3_iot_timeseries_batch_post_with_http_info(self, **kwargs):  # noqa: E501
        """根据指标获取实测时序数据,返回的tspair结构为：T[],V[]. Batch query time-series data of multiple device indicators by time and order by time,return data structure:T[],V[]  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.api_v3_iot_timeseries_batch_post_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param list[TimeseriesBatchForV3Input] timeseries_batch_for_v3_input:
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(list[TimeseriesBatchForV3Output], status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = [
            'timeseries_batch_for_v3_input'
        ]
        all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout'
            ]
        )

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method api_v3_iot_timeseries_batch_post" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'timeseries_batch_for_v3_input' in local_var_params:
            body_params = local_var_params['timeseries_batch_for_v3_input']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json'])  # noqa: E501

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/api/v3/iot/timeseries-batch', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[TimeseriesBatchForV3Output]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)
