# coding: utf-8

"""
    Torizon OTA

     This API is rate limited and will return the following headers for each API call.    - X-RateLimit-Limit - The total number of requests allowed within a time period   - X-RateLimit-Remaining - The total number of requests still allowed until the end of the rate limiting period   - X-RateLimit-Reset - The number of seconds until the limit is fully reset  In addition, if an API client is rate limited, it will receive a HTTP 420 response with the following header:     - Retry-After - The number of seconds to wait until this request is allowed  

    The version of the OpenAPI document: 2.0-Beta
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from pydantic import Field, StrictInt, StrictStr
from typing import List, Optional
from typing_extensions import Annotated
from uuid import UUID
from torizon_io_api.models.detailed_metric_query import DetailedMetricQuery
from torizon_io_api.models.fleet_metrics_outliers_request import FleetMetricsOutliersRequest
from torizon_io_api.models.fleet_metrics_outliers_response import FleetMetricsOutliersResponse
from torizon_io_api.models.metrics_response import MetricsResponse
from torizon_io_api.models.pagination_result_string import PaginationResultString

from torizon_io_api.api_client import ApiClient, RequestSerialized
from torizon_io_api.api_response import ApiResponse
from torizon_io_api.rest import RESTResponseType


class DeviceMetricsApi:
    """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) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    def get_device_data_devices_deviceuuid_detailed_metrics(
        self,
        device_uuid: StrictStr,
        metrics: Annotated[List[StrictStr], Field(min_length=1)],
        var_from: StrictInt,
        to: StrictInt,
        raw_datapoints: Optional[StrictInt] = None,
        total_buckets: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> MetricsResponse:
        """Get detailed metrics data for a single device

          This endpoint will return either a csv or json file of time-bucketed data as reported by the specified device.  Parameters:   * time - beginning of interval in Unix Epoch milliseconds * from - end of interval in Unix Epoch milliseconds * raw_datapoints - number of data points to return in response * total_buckets - number of time buckets to return in response  **Note:** One of raw_datapoints OR total_buckets must be specified in parameters       

        :param device_uuid: (required)
        :type device_uuid: str
        :param metrics: (required)
        :type metrics: List[str]
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param raw_datapoints:
        :type raw_datapoints: int
        :param total_buckets:
        :type total_buckets: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_devices_deviceuuid_detailed_metrics_serialize(
            device_uuid=device_uuid,
            metrics=metrics,
            var_from=var_from,
            to=to,
            raw_datapoints=raw_datapoints,
            total_buckets=total_buckets,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_device_data_devices_deviceuuid_detailed_metrics_with_http_info(
        self,
        device_uuid: StrictStr,
        metrics: Annotated[List[StrictStr], Field(min_length=1)],
        var_from: StrictInt,
        to: StrictInt,
        raw_datapoints: Optional[StrictInt] = None,
        total_buckets: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[MetricsResponse]:
        """Get detailed metrics data for a single device

          This endpoint will return either a csv or json file of time-bucketed data as reported by the specified device.  Parameters:   * time - beginning of interval in Unix Epoch milliseconds * from - end of interval in Unix Epoch milliseconds * raw_datapoints - number of data points to return in response * total_buckets - number of time buckets to return in response  **Note:** One of raw_datapoints OR total_buckets must be specified in parameters       

        :param device_uuid: (required)
        :type device_uuid: str
        :param metrics: (required)
        :type metrics: List[str]
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param raw_datapoints:
        :type raw_datapoints: int
        :param total_buckets:
        :type total_buckets: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_devices_deviceuuid_detailed_metrics_serialize(
            device_uuid=device_uuid,
            metrics=metrics,
            var_from=var_from,
            to=to,
            raw_datapoints=raw_datapoints,
            total_buckets=total_buckets,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_device_data_devices_deviceuuid_detailed_metrics_without_preload_content(
        self,
        device_uuid: StrictStr,
        metrics: Annotated[List[StrictStr], Field(min_length=1)],
        var_from: StrictInt,
        to: StrictInt,
        raw_datapoints: Optional[StrictInt] = None,
        total_buckets: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get detailed metrics data for a single device

          This endpoint will return either a csv or json file of time-bucketed data as reported by the specified device.  Parameters:   * time - beginning of interval in Unix Epoch milliseconds * from - end of interval in Unix Epoch milliseconds * raw_datapoints - number of data points to return in response * total_buckets - number of time buckets to return in response  **Note:** One of raw_datapoints OR total_buckets must be specified in parameters       

        :param device_uuid: (required)
        :type device_uuid: str
        :param metrics: (required)
        :type metrics: List[str]
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param raw_datapoints:
        :type raw_datapoints: int
        :param total_buckets:
        :type total_buckets: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_devices_deviceuuid_detailed_metrics_serialize(
            device_uuid=device_uuid,
            metrics=metrics,
            var_from=var_from,
            to=to,
            raw_datapoints=raw_datapoints,
            total_buckets=total_buckets,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_device_data_devices_deviceuuid_detailed_metrics_serialize(
        self,
        device_uuid,
        metrics,
        var_from,
        to,
        raw_datapoints,
        total_buckets,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'metrics': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if device_uuid is not None:
            _path_params['deviceUuid'] = device_uuid
        # process the query parameters
        if metrics is not None:
            
            _query_params.append(('metrics', metrics))
            
        if var_from is not None:
            
            _query_params.append(('from', var_from))
            
        if to is not None:
            
            _query_params.append(('to', to))
            
        if raw_datapoints is not None:
            
            _query_params.append(('raw_datapoints', raw_datapoints))
            
        if total_buckets is not None:
            
            _query_params.append(('total_buckets', total_buckets))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json', 
                    'text/csv'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'BearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/device-data/devices/{deviceUuid}/detailed-metrics',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_device_data_devices_deviceuuid_metrics(
        self,
        device_uuid: StrictStr,
        var_from: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        to: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        metric: Optional[List[StrictStr]] = None,
        resolution: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> MetricsResponse:
        """Get metrics data from a single device

         This endpoint will return time-bucketed data as reported by the specified device. You must specify a time interval in  Unix Epoch milliseconds via the `from` and `to` query parameters.  You can optionally specify one or more metrics in the query parameter (e.g. `metrics=metric1&metrics=metrics2`, etc.  OR `metrics[]=metric1,metrics2`, etc.). If you do not specify, you will get all metrics available in the repository.  You can also specify a `resolution`. This parameter defaults to 200, with a maximum permitted value of 2000, and  determines the granularity of the data returned. The data returned will be separated into buckets, with each bucket  representing the mean value of the data returned during that period.  For example, suppose you have a device reporting its CPU temperature every minute. You request that metric, with a  resolution of 24 and a time interval that is 1 day long. You will get back 24 data points, each representing a one-hour slice of time. The value returned for each one-hour slice will be the average of the 60 reported  measurements that the device sent during that hour.         

        :param device_uuid: (required)
        :type device_uuid: str
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param metric:
        :type metric: List[str]
        :param resolution:
        :type resolution: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_devices_deviceuuid_metrics_serialize(
            device_uuid=device_uuid,
            var_from=var_from,
            to=to,
            metric=metric,
            resolution=resolution,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_device_data_devices_deviceuuid_metrics_with_http_info(
        self,
        device_uuid: StrictStr,
        var_from: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        to: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        metric: Optional[List[StrictStr]] = None,
        resolution: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[MetricsResponse]:
        """Get metrics data from a single device

         This endpoint will return time-bucketed data as reported by the specified device. You must specify a time interval in  Unix Epoch milliseconds via the `from` and `to` query parameters.  You can optionally specify one or more metrics in the query parameter (e.g. `metrics=metric1&metrics=metrics2`, etc.  OR `metrics[]=metric1,metrics2`, etc.). If you do not specify, you will get all metrics available in the repository.  You can also specify a `resolution`. This parameter defaults to 200, with a maximum permitted value of 2000, and  determines the granularity of the data returned. The data returned will be separated into buckets, with each bucket  representing the mean value of the data returned during that period.  For example, suppose you have a device reporting its CPU temperature every minute. You request that metric, with a  resolution of 24 and a time interval that is 1 day long. You will get back 24 data points, each representing a one-hour slice of time. The value returned for each one-hour slice will be the average of the 60 reported  measurements that the device sent during that hour.         

        :param device_uuid: (required)
        :type device_uuid: str
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param metric:
        :type metric: List[str]
        :param resolution:
        :type resolution: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_devices_deviceuuid_metrics_serialize(
            device_uuid=device_uuid,
            var_from=var_from,
            to=to,
            metric=metric,
            resolution=resolution,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_device_data_devices_deviceuuid_metrics_without_preload_content(
        self,
        device_uuid: StrictStr,
        var_from: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        to: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        metric: Optional[List[StrictStr]] = None,
        resolution: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get metrics data from a single device

         This endpoint will return time-bucketed data as reported by the specified device. You must specify a time interval in  Unix Epoch milliseconds via the `from` and `to` query parameters.  You can optionally specify one or more metrics in the query parameter (e.g. `metrics=metric1&metrics=metrics2`, etc.  OR `metrics[]=metric1,metrics2`, etc.). If you do not specify, you will get all metrics available in the repository.  You can also specify a `resolution`. This parameter defaults to 200, with a maximum permitted value of 2000, and  determines the granularity of the data returned. The data returned will be separated into buckets, with each bucket  representing the mean value of the data returned during that period.  For example, suppose you have a device reporting its CPU temperature every minute. You request that metric, with a  resolution of 24 and a time interval that is 1 day long. You will get back 24 data points, each representing a one-hour slice of time. The value returned for each one-hour slice will be the average of the 60 reported  measurements that the device sent during that hour.         

        :param device_uuid: (required)
        :type device_uuid: str
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param metric:
        :type metric: List[str]
        :param resolution:
        :type resolution: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_devices_deviceuuid_metrics_serialize(
            device_uuid=device_uuid,
            var_from=var_from,
            to=to,
            metric=metric,
            resolution=resolution,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_device_data_devices_deviceuuid_metrics_serialize(
        self,
        device_uuid,
        var_from,
        to,
        metric,
        resolution,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'metric': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if device_uuid is not None:
            _path_params['deviceUuid'] = device_uuid
        # process the query parameters
        if metric is not None:
            
            _query_params.append(('metric', metric))
            
        if var_from is not None:
            
            _query_params.append(('from', var_from))
            
        if to is not None:
            
            _query_params.append(('to', to))
            
        if resolution is not None:
            
            _query_params.append(('resolution', resolution))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'BearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/device-data/devices/{deviceUuid}/metrics',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_device_data_fleets_fleetid_metrics(
        self,
        fleet_id: UUID,
        var_from: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        to: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        metric: Optional[List[StrictStr]] = None,
        resolution: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> MetricsResponse:
        """Get aggregated metrics data from a fleet of devices

         This endpoint will return aggregated time-bucketed data as reported by the devices in the specified fleet. You must  specify a time interval in Unix Epoch milliseconds via the `from` and `to` query parameters.   You can also specify a `resolution`. This parameter defaults to 200, with a maximum permitted value of 2000, and  determines the granularity of the data returned. The data returned will be separated into buckets, with each bucket  representing the aggregated data from the period. For example, if you specify a one day long time interval with a resolution of 24, you will get 24 buckets, each representing a one hour slice of the day. If you request a resolution  of 48, your buckets will be 30 minutes long.  You also must specify one or more metrics as query parameters (e.g. `metrics=metric1&metrics=metrics2`, etc. OR  `metrics[]=metric1,metrics2`, etc.). For each metric you specify, you will get back four different series of datapoints:   * `{metric}-count` reports how many devices in the fleet actually reported data during this time interval. * `{metric}-avg` reports the average value of all reported values for the metric in the period. Note that the average  is over the number of devices that reported data: devices that didn't report the metric during the interval will not be reflected in this datapoint. * `{metric}-max` gives the highest value reported by a device in the specified interval * `{metric}-min` gives the lowest value reported by a device in the specified interval         

        :param fleet_id: (required)
        :type fleet_id: str
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param metric:
        :type metric: List[str]
        :param resolution:
        :type resolution: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_fleets_fleetid_metrics_serialize(
            fleet_id=fleet_id,
            var_from=var_from,
            to=to,
            metric=metric,
            resolution=resolution,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_device_data_fleets_fleetid_metrics_with_http_info(
        self,
        fleet_id: UUID,
        var_from: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        to: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        metric: Optional[List[StrictStr]] = None,
        resolution: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[MetricsResponse]:
        """Get aggregated metrics data from a fleet of devices

         This endpoint will return aggregated time-bucketed data as reported by the devices in the specified fleet. You must  specify a time interval in Unix Epoch milliseconds via the `from` and `to` query parameters.   You can also specify a `resolution`. This parameter defaults to 200, with a maximum permitted value of 2000, and  determines the granularity of the data returned. The data returned will be separated into buckets, with each bucket  representing the aggregated data from the period. For example, if you specify a one day long time interval with a resolution of 24, you will get 24 buckets, each representing a one hour slice of the day. If you request a resolution  of 48, your buckets will be 30 minutes long.  You also must specify one or more metrics as query parameters (e.g. `metrics=metric1&metrics=metrics2`, etc. OR  `metrics[]=metric1,metrics2`, etc.). For each metric you specify, you will get back four different series of datapoints:   * `{metric}-count` reports how many devices in the fleet actually reported data during this time interval. * `{metric}-avg` reports the average value of all reported values for the metric in the period. Note that the average  is over the number of devices that reported data: devices that didn't report the metric during the interval will not be reflected in this datapoint. * `{metric}-max` gives the highest value reported by a device in the specified interval * `{metric}-min` gives the lowest value reported by a device in the specified interval         

        :param fleet_id: (required)
        :type fleet_id: str
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param metric:
        :type metric: List[str]
        :param resolution:
        :type resolution: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_fleets_fleetid_metrics_serialize(
            fleet_id=fleet_id,
            var_from=var_from,
            to=to,
            metric=metric,
            resolution=resolution,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_device_data_fleets_fleetid_metrics_without_preload_content(
        self,
        fleet_id: UUID,
        var_from: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        to: Annotated[int, Field(le=2147483647000, strict=True, ge=1000)],
        metric: Optional[List[StrictStr]] = None,
        resolution: Optional[StrictInt] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get aggregated metrics data from a fleet of devices

         This endpoint will return aggregated time-bucketed data as reported by the devices in the specified fleet. You must  specify a time interval in Unix Epoch milliseconds via the `from` and `to` query parameters.   You can also specify a `resolution`. This parameter defaults to 200, with a maximum permitted value of 2000, and  determines the granularity of the data returned. The data returned will be separated into buckets, with each bucket  representing the aggregated data from the period. For example, if you specify a one day long time interval with a resolution of 24, you will get 24 buckets, each representing a one hour slice of the day. If you request a resolution  of 48, your buckets will be 30 minutes long.  You also must specify one or more metrics as query parameters (e.g. `metrics=metric1&metrics=metrics2`, etc. OR  `metrics[]=metric1,metrics2`, etc.). For each metric you specify, you will get back four different series of datapoints:   * `{metric}-count` reports how many devices in the fleet actually reported data during this time interval. * `{metric}-avg` reports the average value of all reported values for the metric in the period. Note that the average  is over the number of devices that reported data: devices that didn't report the metric during the interval will not be reflected in this datapoint. * `{metric}-max` gives the highest value reported by a device in the specified interval * `{metric}-min` gives the lowest value reported by a device in the specified interval         

        :param fleet_id: (required)
        :type fleet_id: str
        :param var_from: (required)
        :type var_from: int
        :param to: (required)
        :type to: int
        :param metric:
        :type metric: List[str]
        :param resolution:
        :type resolution: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_fleets_fleetid_metrics_serialize(
            fleet_id=fleet_id,
            var_from=var_from,
            to=to,
            metric=metric,
            resolution=resolution,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_device_data_fleets_fleetid_metrics_serialize(
        self,
        fleet_id,
        var_from,
        to,
        metric,
        resolution,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'metric': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if fleet_id is not None:
            _path_params['fleetId'] = fleet_id
        # process the query parameters
        if metric is not None:
            
            _query_params.append(('metric', metric))
            
        if var_from is not None:
            
            _query_params.append(('from', var_from))
            
        if to is not None:
            
            _query_params.append(('to', to))
            
        if resolution is not None:
            
            _query_params.append(('resolution', resolution))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'BearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/device-data/fleets/{fleetId}/metrics',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def get_device_data_metric_names(
        self,
        var_from: Optional[Annotated[int, Field(le=2147483647000, strict=True, ge=1000)]] = None,
        to: Optional[Annotated[int, Field(le=2147483647000, strict=True, ge=1000)]] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> PaginationResultString:
        """Get the list of metrics available in your repository

         Lists the metrics available in your repository.  In the default TorizonCore configuration, devices will report certain default metrics. You can also add your own metrics, as described in the [TorizonCore documentation](https://developer.toradex.com/torizon/torizon-platform/device-monitoring-in-torizoncore/#customizing-device-metrics-for-torizon-platform). Calling this endpoint will give you the list of valid metric names for your repository; generally this will include the default set plus any that you have defined yourself.  You can optionally specify a time interval in Unix Epoch milliseconds via the `from` and `to` query parameters. This will return the list of metrics reported by devices in your repository during that specific interval.         

        :param var_from:
        :type var_from: int
        :param to:
        :type to: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_metric_names_serialize(
            var_from=var_from,
            to=to,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PaginationResultString",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def get_device_data_metric_names_with_http_info(
        self,
        var_from: Optional[Annotated[int, Field(le=2147483647000, strict=True, ge=1000)]] = None,
        to: Optional[Annotated[int, Field(le=2147483647000, strict=True, ge=1000)]] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[PaginationResultString]:
        """Get the list of metrics available in your repository

         Lists the metrics available in your repository.  In the default TorizonCore configuration, devices will report certain default metrics. You can also add your own metrics, as described in the [TorizonCore documentation](https://developer.toradex.com/torizon/torizon-platform/device-monitoring-in-torizoncore/#customizing-device-metrics-for-torizon-platform). Calling this endpoint will give you the list of valid metric names for your repository; generally this will include the default set plus any that you have defined yourself.  You can optionally specify a time interval in Unix Epoch milliseconds via the `from` and `to` query parameters. This will return the list of metrics reported by devices in your repository during that specific interval.         

        :param var_from:
        :type var_from: int
        :param to:
        :type to: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_metric_names_serialize(
            var_from=var_from,
            to=to,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PaginationResultString",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def get_device_data_metric_names_without_preload_content(
        self,
        var_from: Optional[Annotated[int, Field(le=2147483647000, strict=True, ge=1000)]] = None,
        to: Optional[Annotated[int, Field(le=2147483647000, strict=True, ge=1000)]] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get the list of metrics available in your repository

         Lists the metrics available in your repository.  In the default TorizonCore configuration, devices will report certain default metrics. You can also add your own metrics, as described in the [TorizonCore documentation](https://developer.toradex.com/torizon/torizon-platform/device-monitoring-in-torizoncore/#customizing-device-metrics-for-torizon-platform). Calling this endpoint will give you the list of valid metric names for your repository; generally this will include the default set plus any that you have defined yourself.  You can optionally specify a time interval in Unix Epoch milliseconds via the `from` and `to` query parameters. This will return the list of metrics reported by devices in your repository during that specific interval.         

        :param var_from:
        :type var_from: int
        :param to:
        :type to: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_device_data_metric_names_serialize(
            var_from=var_from,
            to=to,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PaginationResultString",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_device_data_metric_names_serialize(
        self,
        var_from,
        to,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if var_from is not None:
            
            _query_params.append(('from', var_from))
            
        if to is not None:
            
            _query_params.append(('to', to))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'BearerAuth'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/device-data/metric-names',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def post_device_data_fleets_fleetid_metrics_outliers(
        self,
        fleet_id: UUID,
        fleet_metrics_outliers_request: FleetMetricsOutliersRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> FleetMetricsOutliersResponse:
        """Get fleet outlier metrics from a fleet of devices

         Response will contain a list of outlier metrics for the provided fleet of devices  The Request Body contains several keys: * metrics - a list of metric names (max of 5) * from - unix timestamp (milliseconds since epoch) marking beginning of sample * to - unix timestamp (milliseconds since epoch) marking end of sample * aggregation - Optional whether the outliers are above or below the average. Min|Max (default Max) * limit - Optional Int limiting number of response values (maximum is 10)           

        :param fleet_id: (required)
        :type fleet_id: str
        :param fleet_metrics_outliers_request: (required)
        :type fleet_metrics_outliers_request: FleetMetricsOutliersRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_device_data_fleets_fleetid_metrics_outliers_serialize(
            fleet_id=fleet_id,
            fleet_metrics_outliers_request=fleet_metrics_outliers_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "FleetMetricsOutliersResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def post_device_data_fleets_fleetid_metrics_outliers_with_http_info(
        self,
        fleet_id: UUID,
        fleet_metrics_outliers_request: FleetMetricsOutliersRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[FleetMetricsOutliersResponse]:
        """Get fleet outlier metrics from a fleet of devices

         Response will contain a list of outlier metrics for the provided fleet of devices  The Request Body contains several keys: * metrics - a list of metric names (max of 5) * from - unix timestamp (milliseconds since epoch) marking beginning of sample * to - unix timestamp (milliseconds since epoch) marking end of sample * aggregation - Optional whether the outliers are above or below the average. Min|Max (default Max) * limit - Optional Int limiting number of response values (maximum is 10)           

        :param fleet_id: (required)
        :type fleet_id: str
        :param fleet_metrics_outliers_request: (required)
        :type fleet_metrics_outliers_request: FleetMetricsOutliersRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_device_data_fleets_fleetid_metrics_outliers_serialize(
            fleet_id=fleet_id,
            fleet_metrics_outliers_request=fleet_metrics_outliers_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "FleetMetricsOutliersResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def post_device_data_fleets_fleetid_metrics_outliers_without_preload_content(
        self,
        fleet_id: UUID,
        fleet_metrics_outliers_request: FleetMetricsOutliersRequest,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get fleet outlier metrics from a fleet of devices

         Response will contain a list of outlier metrics for the provided fleet of devices  The Request Body contains several keys: * metrics - a list of metric names (max of 5) * from - unix timestamp (milliseconds since epoch) marking beginning of sample * to - unix timestamp (milliseconds since epoch) marking end of sample * aggregation - Optional whether the outliers are above or below the average. Min|Max (default Max) * limit - Optional Int limiting number of response values (maximum is 10)           

        :param fleet_id: (required)
        :type fleet_id: str
        :param fleet_metrics_outliers_request: (required)
        :type fleet_metrics_outliers_request: FleetMetricsOutliersRequest
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_device_data_fleets_fleetid_metrics_outliers_serialize(
            fleet_id=fleet_id,
            fleet_metrics_outliers_request=fleet_metrics_outliers_request,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "FleetMetricsOutliersResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _post_device_data_fleets_fleetid_metrics_outliers_serialize(
        self,
        fleet_id,
        fleet_metrics_outliers_request,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if fleet_id is not None:
            _path_params['fleetId'] = fleet_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if fleet_metrics_outliers_request is not None:
            _body_params = fleet_metrics_outliers_request


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'BearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/device-data/fleets/{fleetId}/metrics/outliers',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    def post_device_data_fleets_fleetid_metrics_report(
        self,
        fleet_id: UUID,
        detailed_metric_query: DetailedMetricQuery,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> MetricsResponse:
        """Get metrics report for fleet of devices

         Returns either a csv or json file of all the datapoints specified in the query  The query contains these keys:  * metrics - a list of metric names * from - unix timestamp (milliseconds since epoch) marking beginning of report * to - unix timestamp (milliseconds since epoch) marking end of report * datapointCount - Optional Int - the total number of datapoints to be included in the report * totalBuckets - Optional Int - the total number of buckets to be included in the report    **Note:** One of datapointCount OR totalBuckets must be specified           

        :param fleet_id: (required)
        :type fleet_id: str
        :param detailed_metric_query: (required)
        :type detailed_metric_query: DetailedMetricQuery
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_device_data_fleets_fleetid_metrics_report_serialize(
            fleet_id=fleet_id,
            detailed_metric_query=detailed_metric_query,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    def post_device_data_fleets_fleetid_metrics_report_with_http_info(
        self,
        fleet_id: UUID,
        detailed_metric_query: DetailedMetricQuery,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[MetricsResponse]:
        """Get metrics report for fleet of devices

         Returns either a csv or json file of all the datapoints specified in the query  The query contains these keys:  * metrics - a list of metric names * from - unix timestamp (milliseconds since epoch) marking beginning of report * to - unix timestamp (milliseconds since epoch) marking end of report * datapointCount - Optional Int - the total number of datapoints to be included in the report * totalBuckets - Optional Int - the total number of buckets to be included in the report    **Note:** One of datapointCount OR totalBuckets must be specified           

        :param fleet_id: (required)
        :type fleet_id: str
        :param detailed_metric_query: (required)
        :type detailed_metric_query: DetailedMetricQuery
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_device_data_fleets_fleetid_metrics_report_serialize(
            fleet_id=fleet_id,
            detailed_metric_query=detailed_metric_query,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    def post_device_data_fleets_fleetid_metrics_report_without_preload_content(
        self,
        fleet_id: UUID,
        detailed_metric_query: DetailedMetricQuery,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get metrics report for fleet of devices

         Returns either a csv or json file of all the datapoints specified in the query  The query contains these keys:  * metrics - a list of metric names * from - unix timestamp (milliseconds since epoch) marking beginning of report * to - unix timestamp (milliseconds since epoch) marking end of report * datapointCount - Optional Int - the total number of datapoints to be included in the report * totalBuckets - Optional Int - the total number of buckets to be included in the report    **Note:** One of datapointCount OR totalBuckets must be specified           

        :param fleet_id: (required)
        :type fleet_id: str
        :param detailed_metric_query: (required)
        :type detailed_metric_query: DetailedMetricQuery
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._post_device_data_fleets_fleetid_metrics_report_serialize(
            fleet_id=fleet_id,
            detailed_metric_query=detailed_metric_query,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "MetricsResponse",
            '400': "PostUpdates400Response",
            '404': "NotFoundRepr",
            '416': "RangeNotSatisfiableRepr",
        }
        response_data = self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _post_device_data_fleets_fleetid_metrics_report_serialize(
        self,
        fleet_id,
        detailed_metric_query,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        if fleet_id is not None:
            _path_params['fleetId'] = fleet_id
        # process the query parameters
        # process the header parameters
        # process the form parameters
        # process the body parameter
        if detailed_metric_query is not None:
            _body_params = detailed_metric_query


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json', 
                    'text/csv'
                ]
            )

        # set the HTTP header `Content-Type`
        if _content_type:
            _header_params['Content-Type'] = _content_type
        else:
            _default_content_type = (
                self.api_client.select_header_content_type(
                    [
                        'application/json'
                    ]
                )
            )
            if _default_content_type is not None:
                _header_params['Content-Type'] = _default_content_type

        # authentication setting
        _auth_settings: List[str] = [
            'BearerAuth'
        ]

        return self.api_client.param_serialize(
            method='POST',
            resource_path='/device-data/fleets/{fleetId}/metrics/report',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


