# coding: utf-8

"""
    Eclipse Kapua REST API

    No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)  # noqa: E501

    OpenAPI spec version: 1.0
    
    Generated by: https://github.com/swagger-api/swagger-codegen.git
"""


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from swagger_client.api_client import ApiClient


class DevicesApi(object):
    """NOTE: This class is auto generated by the swagger code generator program.

    Do not edit the class manually.
    Ref: https://github.com/swagger-api/swagger-codegen
    """

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

    def device_asset_filtered_get(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of assets  # noqa: E501

        Returns the list of all the Assets installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_asset_filtered_get(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :param DeviceAssets body: The filter of the request
        :return: DeviceAssets
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_asset_filtered_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_asset_filtered_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_asset_filtered_get_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of assets  # noqa: E501

        Returns the list of all the Assets installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_asset_filtered_get_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :param DeviceAssets body: The filter of the request
        :return: DeviceAssets
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'timeout', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_asset_filtered_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_asset_filtered_get`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_asset_filtered_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/assets', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceAssets',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_asset_get(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of assets  # noqa: E501

        Returns the list of all the Assets installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_asset_get(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceAssets
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_asset_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_asset_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_asset_get_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of assets  # noqa: E501

        Returns the list of all the Assets installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_asset_get_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceAssets
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_asset_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_asset_get`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_asset_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/assets', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceAssets',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_asset_read(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Reads asset channel values  # noqa: E501

        Returns the value read from the asset channel  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_asset_read(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :param DeviceAssets body: The filter of the read request
        :return: DeviceAssets
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_asset_read_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_asset_read_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_asset_read_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Reads asset channel values  # noqa: E501

        Returns the value read from the asset channel  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_asset_read_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :param DeviceAssets body: The filter of the read request
        :return: DeviceAssets
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'timeout', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_asset_read" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_asset_read`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_asset_read`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/assets/_read', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceAssets',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_asset_write(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of assets  # noqa: E501

        Returns the list of all the Assets installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_asset_write(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :param DeviceAssets body: The values to write to the asset channels
        :return: DeviceAssets
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_asset_write_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_asset_write_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_asset_write_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of assets  # noqa: E501

        Returns the list of all the Assets installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_asset_write_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :param DeviceAssets body: The values to write to the asset channels
        :return: DeviceAssets
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'timeout', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_asset_write" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_asset_write`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_asset_write`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/assets/_write', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceAssets',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_bundle_get(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of bundles  # noqa: E501

        Returns the list of all the Bundles installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_bundle_get(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceBundles
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_bundle_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_bundle_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_bundle_get_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of bundles  # noqa: E501

        Returns the list of all the Bundles installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_bundle_get_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceBundles
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_bundle_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_bundle_get`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_bundle_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/bundles', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceBundles',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_bundle_start(self, scope_id, device_id, bundle_id, **kwargs):  # noqa: E501
        """Start a bundle  # noqa: E501

        Starts the specified bundle  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_bundle_start(scope_id, device_id, bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param str bundle_id: the ID of the bundle to start (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_bundle_start_with_http_info(scope_id, device_id, bundle_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_bundle_start_with_http_info(scope_id, device_id, bundle_id, **kwargs)  # noqa: E501
            return data

    def device_bundle_start_with_http_info(self, scope_id, device_id, bundle_id, **kwargs):  # noqa: E501
        """Start a bundle  # noqa: E501

        Starts the specified bundle  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_bundle_start_with_http_info(scope_id, device_id, bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param str bundle_id: the ID of the bundle to start (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'bundle_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_bundle_start" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_bundle_start`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_bundle_start`")  # noqa: E501
        # verify the required parameter 'bundle_id' is set
        if ('bundle_id' not in params or
                params['bundle_id'] is None):
            raise ValueError("Missing the required parameter `bundle_id` when calling `device_bundle_start`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'bundle_id' in params:
            path_params['bundleId'] = params['bundle_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/bundles/{bundleId}/_start', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_bundle_stop(self, scope_id, device_id, bundle_id, **kwargs):  # noqa: E501
        """Stop a bundle  # noqa: E501

        Stops the specified bundle  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_bundle_stop(scope_id, device_id, bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param str bundle_id: the ID of the bundle to stop (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_bundle_stop_with_http_info(scope_id, device_id, bundle_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_bundle_stop_with_http_info(scope_id, device_id, bundle_id, **kwargs)  # noqa: E501
            return data

    def device_bundle_stop_with_http_info(self, scope_id, device_id, bundle_id, **kwargs):  # noqa: E501
        """Stop a bundle  # noqa: E501

        Stops the specified bundle  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_bundle_stop_with_http_info(scope_id, device_id, bundle_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device. (required)
        :param str device_id: The id of the device (required)
        :param str bundle_id: the ID of the bundle to stop (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'bundle_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_bundle_stop" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_bundle_stop`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_bundle_stop`")  # noqa: E501
        # verify the required parameter 'bundle_id' is set
        if ('bundle_id' not in params or
                params['bundle_id'] is None):
            raise ValueError("Missing the required parameter `bundle_id` when calling `device_bundle_stop`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'bundle_id' in params:
            path_params['bundleId'] = params['bundle_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/bundles/{bundleId}/_stop', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_command_execute(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Executes a command  # noqa: E501

        Executes a remote command on a device and return the command output.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_command_execute(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device (required)
        :param str device_id: The id of the device (required)
        :param DeviceCommandInput body: The input command (required)
        :param int timeout: The timeout of the command execution
        :return: DeviceCommandOutput
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_command_execute_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_command_execute_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
            return data

    def device_command_execute_with_http_info(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Executes a command  # noqa: E501

        Executes a remote command on a device and return the command output.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_command_execute_with_http_info(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device (required)
        :param str device_id: The id of the device (required)
        :param DeviceCommandInput body: The input command (required)
        :param int timeout: The timeout of the command execution
        :return: DeviceCommandOutput
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'body', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_command_execute" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_command_execute`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_command_execute`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_command_execute`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/commands/_execute', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceCommandOutput',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_configuration_component_get(self, scope_id, device_id, component_id, **kwargs):  # noqa: E501
        """Gets the configuration of a component on a device  # noqa: E501

        Returns the configuration of a device or the configuration of the OSGi component identified with specified PID (service's persistent identity). In the OSGi framework, the service's persistent identity is defined as the name attribute of the Component Descriptor XML file; at runtime, the same value is also available in the component.name and in the service.pid attributes of the Component Configuration.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_configuration_component_get(scope_id, device_id, component_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device. (required)
        :param str device_id: The id of the device (required)
        :param str component_id: An optional id of the component to get the configuration for (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceConfiguration
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_configuration_component_get_with_http_info(scope_id, device_id, component_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_configuration_component_get_with_http_info(scope_id, device_id, component_id, **kwargs)  # noqa: E501
            return data

    def device_configuration_component_get_with_http_info(self, scope_id, device_id, component_id, **kwargs):  # noqa: E501
        """Gets the configuration of a component on a device  # noqa: E501

        Returns the configuration of a device or the configuration of the OSGi component identified with specified PID (service's persistent identity). In the OSGi framework, the service's persistent identity is defined as the name attribute of the Component Descriptor XML file; at runtime, the same value is also available in the component.name and in the service.pid attributes of the Component Configuration.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_configuration_component_get_with_http_info(scope_id, device_id, component_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device. (required)
        :param str device_id: The id of the device (required)
        :param str component_id: An optional id of the component to get the configuration for (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceConfiguration
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'component_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_configuration_component_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_configuration_component_get`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_configuration_component_get`")  # noqa: E501
        # verify the required parameter 'component_id' is set
        if ('component_id' not in params or
                params['component_id'] is None):
            raise ValueError("Missing the required parameter `component_id` when calling `device_configuration_component_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'component_id' in params:
            path_params['componentId'] = params['component_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/configurations/{componentId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceConfiguration',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_configuration_component_update(self, scope_id, device_id, component_id, body, **kwargs):  # noqa: E501
        """Updates the configuration of a component on a device  # noqa: E501

        Updates a device component configuration  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_configuration_component_update(scope_id, device_id, component_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device. (required)
        :param str device_id: The id of the device (required)
        :param str component_id: The component id to update (required)
        :param DeviceComponentConfiguration body: The component configuration to send to the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceConfiguration
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_configuration_component_update_with_http_info(scope_id, device_id, component_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_configuration_component_update_with_http_info(scope_id, device_id, component_id, body, **kwargs)  # noqa: E501
            return data

    def device_configuration_component_update_with_http_info(self, scope_id, device_id, component_id, body, **kwargs):  # noqa: E501
        """Updates the configuration of a component on a device  # noqa: E501

        Updates a device component configuration  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_configuration_component_update_with_http_info(scope_id, device_id, component_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device. (required)
        :param str device_id: The id of the device (required)
        :param str component_id: The component id to update (required)
        :param DeviceComponentConfiguration body: The component configuration to send to the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceConfiguration
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'component_id', 'body', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_configuration_component_update" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_configuration_component_update`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_configuration_component_update`")  # noqa: E501
        # verify the required parameter 'component_id' is set
        if ('component_id' not in params or
                params['component_id'] is None):
            raise ValueError("Missing the required parameter `component_id` when calling `device_configuration_component_update`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_configuration_component_update`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'component_id' in params:
            path_params['componentId'] = params['component_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/configurations/{componentId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceConfiguration',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_configuration_get(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets the device configurations  # noqa: E501

        Returns the current configuration of a device  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_configuration_get(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceConfiguration
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_configuration_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_configuration_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_configuration_get_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets the device configurations  # noqa: E501

        Returns the current configuration of a device  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_configuration_get_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device. (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceConfiguration
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_configuration_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_configuration_get`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_configuration_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/configurations', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceConfiguration',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_configuration_update(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Updates a device configuration  # noqa: E501

        Updates a device configuration  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_configuration_update(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device. (required)
        :param str device_id: The id of the device (required)
        :param DeviceConfiguration body: The configuration to send to the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceConfiguration
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_configuration_update_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_configuration_update_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
            return data

    def device_configuration_update_with_http_info(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Updates a device configuration  # noqa: E501

        Updates a device configuration  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_configuration_update_with_http_info(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device. (required)
        :param str device_id: The id of the device (required)
        :param DeviceConfiguration body: The configuration to send to the device (required)
        :param int timeout: The timeout of the operation in milliseconds
        :return: DeviceConfiguration
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'body', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_configuration_update" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_configuration_update`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_configuration_update`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_configuration_update`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Content-Type`
        header_params['Content-Type'] = self.api_client.select_header_content_type(  # noqa: E501
            ['application/json', 'application/xml'])  # noqa: E501

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/configurations', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceConfiguration',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_count(self, scope_id, body, **kwargs):  # noqa: E501
        """Counts the Devices  # noqa: E501

        Counts the Devices with the given DeviceQuery parameter returning the number of matching Devices  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_count(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to count results (required)
        :param DeviceQuery body: The DeviceQuery to use to filter count results (required)
        :return: CountResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_count_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_count_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def device_count_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Counts the Devices  # noqa: E501

        Counts the Devices with the given DeviceQuery parameter returning the number of matching Devices  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_count_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to count results (required)
        :param DeviceQuery body: The DeviceQuery to use to filter count results (required)
        :return: CountResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_count" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_count`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_count`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/_count', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CountResult',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_create(self, scope_id, body, **kwargs):  # noqa: E501
        """Create an Device  # noqa: E501

        Creates a new Device based on the information provided in DeviceCreator parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_create(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to create the Device. (required)
        :param DeviceCreator body: Provides the information for the new Device to be created (required)
        :return: Device
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_create_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_create_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def device_create_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Create an Device  # noqa: E501

        Creates a new Device based on the information provided in DeviceCreator parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_create_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to create the Device. (required)
        :param DeviceCreator body: Provides the information for the new Device to be created (required)
        :return: Device
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_create" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_create`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_create`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Device',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_delete(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Delete a Device  # noqa: E501

        Deletes the Device specified by the \"deviceId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_delete(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device to delete. (required)
        :param str device_id: The id of the Device to be deleted (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_delete_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_delete_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_delete_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Delete a Device  # noqa: E501

        Deletes the Device specified by the \"deviceId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_delete_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device to delete. (required)
        :param str device_id: The id of the Device to be deleted (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_delete" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_delete`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_delete`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_event_count(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Counts the DeviceEvents  # noqa: E501

        Counts the DeviceEvents with the given DeviceEventQuery parameter returning the number of matching DeviceEvents  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_count(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to count results. (required)
        :param str device_id: The id of the Device in which to count results (required)
        :param DeviceEventQuery body: The DeviceEventQuery to use to filter count results (required)
        :return: CountResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_event_count_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_event_count_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
            return data

    def device_event_count_with_http_info(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Counts the DeviceEvents  # noqa: E501

        Counts the DeviceEvents with the given DeviceEventQuery parameter returning the number of matching DeviceEvents  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_count_with_http_info(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to count results. (required)
        :param str device_id: The id of the Device in which to count results (required)
        :param DeviceEventQuery body: The DeviceEventQuery to use to filter count results (required)
        :return: CountResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_event_count" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_event_count`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_event_count`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_event_count`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/events/_count', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CountResult',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_event_delete(self, scope_id, device_id, device_event_id, **kwargs):  # noqa: E501
        """Delete a DeviceEvent  # noqa: E501

        Deletes the DeviceEvent specified by the \"deviceEventId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_delete(scope_id, device_id, device_event_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: (required)
        :param str device_id: The id of the Device in which to delete the event. (required)
        :param str device_event_id: The id of the DeviceEvent to be deleted (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_event_delete_with_http_info(scope_id, device_id, device_event_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_event_delete_with_http_info(scope_id, device_id, device_event_id, **kwargs)  # noqa: E501
            return data

    def device_event_delete_with_http_info(self, scope_id, device_id, device_event_id, **kwargs):  # noqa: E501
        """Delete a DeviceEvent  # noqa: E501

        Deletes the DeviceEvent specified by the \"deviceEventId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_delete_with_http_info(scope_id, device_id, device_event_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: (required)
        :param str device_id: The id of the Device in which to delete the event. (required)
        :param str device_event_id: The id of the DeviceEvent to be deleted (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'device_event_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_event_delete" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_event_delete`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_event_delete`")  # noqa: E501
        # verify the required parameter 'device_event_id' is set
        if ('device_event_id' not in params or
                params['device_event_id'] is None):
            raise ValueError("Missing the required parameter `device_event_id` when calling `device_event_delete`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'device_event_id' in params:
            path_params['deviceEventId'] = params['device_event_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/events/{deviceEventId}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_event_find(self, scope_id, device_id, device_event_id, **kwargs):  # noqa: E501
        """Get an DeviceEvent  # noqa: E501

        Returns the DeviceEvent specified by the \"deviceEventId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_find(scope_id, device_id, device_event_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested DeviceEvent. (required)
        :param str device_id: The id of the requested Device (required)
        :param str device_event_id: The id of the requested DeviceEvent (required)
        :return: DeviceEvent
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_event_find_with_http_info(scope_id, device_id, device_event_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_event_find_with_http_info(scope_id, device_id, device_event_id, **kwargs)  # noqa: E501
            return data

    def device_event_find_with_http_info(self, scope_id, device_id, device_event_id, **kwargs):  # noqa: E501
        """Get an DeviceEvent  # noqa: E501

        Returns the DeviceEvent specified by the \"deviceEventId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_find_with_http_info(scope_id, device_id, device_event_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested DeviceEvent. (required)
        :param str device_id: The id of the requested Device (required)
        :param str device_event_id: The id of the requested DeviceEvent (required)
        :return: DeviceEvent
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'device_event_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_event_find" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_event_find`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_event_find`")  # noqa: E501
        # verify the required parameter 'device_event_id' is set
        if ('device_event_id' not in params or
                params['device_event_id'] is None):
            raise ValueError("Missing the required parameter `device_event_id` when calling `device_event_find`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'device_event_id' in params:
            path_params['deviceEventId'] = params['device_event_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/events/{deviceEventId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceEvent',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_event_query(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Queries the DeviceEvents  # noqa: E501

        Queries the DeviceEvents with the given DeviceEvents parameter returning all matching DeviceEvents  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_query(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param str device_id: The id of the Device in which to search results (required)
        :param DeviceEventQuery body: The DeviceEventQuery to use to filter results. (required)
        :return: DeviceEventListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_event_query_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_event_query_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
            return data

    def device_event_query_with_http_info(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Queries the DeviceEvents  # noqa: E501

        Queries the DeviceEvents with the given DeviceEvents parameter returning all matching DeviceEvents  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_query_with_http_info(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param str device_id: The id of the Device in which to search results (required)
        :param DeviceEventQuery body: The DeviceEventQuery to use to filter results. (required)
        :return: DeviceEventListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_event_query" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_event_query`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_event_query`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_event_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/events/_query', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceEventListResult',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_event_simple_query(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets the DeviceEvent list in the scope  # noqa: E501

        Returns the list of all the deviceEvents associated to the current selected scope.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_simple_query(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param str device_id: The client id to filter results. (required)
        :param str resource: The resource of the DeviceEvent in which to search results
        :param int offset: The result set offset.
        :param int limit: The result set limit.
        :return: DeviceEventListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_event_simple_query_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_event_simple_query_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_event_simple_query_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets the DeviceEvent list in the scope  # noqa: E501

        Returns the list of all the deviceEvents associated to the current selected scope.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_event_simple_query_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param str device_id: The client id to filter results. (required)
        :param str resource: The resource of the DeviceEvent in which to search results
        :param int offset: The result set offset.
        :param int limit: The result set limit.
        :return: DeviceEventListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'resource', 'offset', 'limit']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_event_simple_query" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_event_simple_query`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_event_simple_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'resource' in params:
            query_params.append(('resource', params['resource']))  # noqa: E501
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/events', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceEventListResult',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_find(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Get a Device  # noqa: E501

        Returns the Device specified by the \"deviceId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_find(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Device (required)
        :param str device_id: The id of the requested Device (required)
        :return: Device
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_find_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_find_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_find_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Get a Device  # noqa: E501

        Returns the Device specified by the \"deviceId\" path parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_find_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Device (required)
        :param str device_id: The id of the requested Device (required)
        :return: Device
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_find" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_find`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_find`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Device',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_package_download(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Installs a package  # noqa: E501

        Installs a package into the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_package_download(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device (required)
        :param str device_id: The id of the device (required)
        :param DevicePackageDownloadRequest body: Mandatory object with all the informations needed to download and install a package (required)
        :param int timeout: The timeout of the operation
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_package_download_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_package_download_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
            return data

    def device_package_download_with_http_info(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Installs a package  # noqa: E501

        Installs a package into the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_package_download_with_http_info(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device (required)
        :param str device_id: The id of the device (required)
        :param DevicePackageDownloadRequest body: Mandatory object with all the informations needed to download and install a package (required)
        :param int timeout: The timeout of the operation
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'body', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_package_download" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_package_download`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_package_download`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_package_download`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/packages/_download', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_package_get(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of packages  # noqa: E501

        Returns the list of all the packages installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_package_get(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation
        :return: DevicePackages
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_package_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_package_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_package_get_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of packages  # noqa: E501

        Returns the list of all the packages installed on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_package_get_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation
        :return: DevicePackages
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_package_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_package_get`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_package_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/packages', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DevicePackages',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_package_uninstall(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Uninstalls a package  # noqa: E501

        Uninstalls a package into the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_package_uninstall(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device (required)
        :param str device_id: The id of the device (required)
        :param DevicePackageUninstallRequest body: Mandatory object with all the informations needed to uninstall a package (required)
        :param int timeout: The timeout of the operation
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_package_uninstall_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_package_uninstall_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
            return data

    def device_package_uninstall_with_http_info(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Uninstalls a package  # noqa: E501

        Uninstalls a package into the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_package_uninstall_with_http_info(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the Device (required)
        :param str device_id: The id of the device (required)
        :param DevicePackageUninstallRequest body: Mandatory object with all the informations needed to uninstall a package (required)
        :param int timeout: The timeout of the operation
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'body', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_package_uninstall" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_package_uninstall`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_package_uninstall`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_package_uninstall`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/packages/_uninstall', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_query(self, scope_id, body, **kwargs):  # noqa: E501
        """Queries the Devices  # noqa: E501

        Queries the Devices with the given Devices parameter returning all matching Devices  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_query(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param DeviceQuery body: The DeviceQuery to use to filter results. (required)
        :return: DeviceListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_query_with_http_info(scope_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_query_with_http_info(scope_id, body, **kwargs)  # noqa: E501
            return data

    def device_query_with_http_info(self, scope_id, body, **kwargs):  # noqa: E501
        """Queries the Devices  # noqa: E501

        Queries the Devices with the given Devices parameter returning all matching Devices  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_query_with_http_info(scope_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param DeviceQuery body: The DeviceQuery to use to filter results. (required)
        :return: DeviceListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_query" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_query`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/_query', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceListResult',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_request_send(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Sends a request  # noqa: E501

        Sends a request message to a device  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_request_send(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device (required)
        :param str device_id: The id of the device (required)
        :param JsonGenericRequestMessage body: The input request (required)
        :param int timeout: The timeout of the request execution
        :return: JsonGenericResponseMessage
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_request_send_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_request_send_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
            return data

    def device_request_send_with_http_info(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Sends a request  # noqa: E501

        Sends a request message to a device  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_request_send_with_http_info(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device (required)
        :param str device_id: The id of the device (required)
        :param JsonGenericRequestMessage body: The input request (required)
        :param int timeout: The timeout of the request execution
        :return: JsonGenericResponseMessage
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'body', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_request_send" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_request_send`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_request_send`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_request_send`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/requests', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='JsonGenericResponseMessage',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_simple_query(self, scope_id, **kwargs):  # noqa: E501
        """Gets the Device list in the scope  # noqa: E501

        Returns the list of all the devices associated to the current selected scope.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_simple_query(scope_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param str tag_id: The tag id to filter results.
        :param str client_id: The client id to filter results.
        :param str status: The connection status to filter results.
        :param list[str] fetch_attributes: Additional attributes to be returned. Allowed values: connection, lastEvent
        :param int offset: The result set offset.
        :param int limit: The result set limit.
        :return: DeviceListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_simple_query_with_http_info(scope_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_simple_query_with_http_info(scope_id, **kwargs)  # noqa: E501
            return data

    def device_simple_query_with_http_info(self, scope_id, **kwargs):  # noqa: E501
        """Gets the Device list in the scope  # noqa: E501

        Returns the list of all the devices associated to the current selected scope.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_simple_query_with_http_info(scope_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId in which to search results. (required)
        :param str tag_id: The tag id to filter results.
        :param str client_id: The client id to filter results.
        :param str status: The connection status to filter results.
        :param list[str] fetch_attributes: Additional attributes to be returned. Allowed values: connection, lastEvent
        :param int offset: The result set offset.
        :param int limit: The result set limit.
        :return: DeviceListResult
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'tag_id', 'client_id', 'status', 'fetch_attributes', 'offset', 'limit']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_simple_query" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_simple_query`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501

        query_params = []
        if 'tag_id' in params:
            query_params.append(('tagId', params['tag_id']))  # noqa: E501
        if 'client_id' in params:
            query_params.append(('clientId', params['client_id']))  # noqa: E501
        if 'status' in params:
            query_params.append(('status', params['status']))  # noqa: E501
        if 'fetch_attributes' in params:
            query_params.append(('fetchAttributes', params['fetch_attributes']))  # noqa: E501
            collection_formats['fetchAttributes'] = 'multi'  # noqa: E501
        if 'offset' in params:
            query_params.append(('offset', params['offset']))  # noqa: E501
        if 'limit' in params:
            query_params.append(('limit', params['limit']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceListResult',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_snapshot_get(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of snapshots  # noqa: E501

        Returns the list of all the Snapshots available on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_snapshot_get(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation
        :return: DeviceSnapshots
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_snapshot_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_snapshot_get_with_http_info(scope_id, device_id, **kwargs)  # noqa: E501
            return data

    def device_snapshot_get_with_http_info(self, scope_id, device_id, **kwargs):  # noqa: E501
        """Gets a list of snapshots  # noqa: E501

        Returns the list of all the Snapshots available on the device.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_snapshot_get_with_http_info(scope_id, device_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device (required)
        :param str device_id: The id of the device (required)
        :param int timeout: The timeout of the operation
        :return: DeviceSnapshots
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_snapshot_get" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_snapshot_get`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_snapshot_get`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/snapshots', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeviceSnapshots',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_snapshot_rollback(self, scope_id, device_id, snapshot_id, **kwargs):  # noqa: E501
        """Gets a list of snapshots  # noqa: E501

        Updates the configuration of a device rolling back a given snapshot ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_snapshot_rollback(scope_id, device_id, snapshot_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device (required)
        :param str device_id: The id of the device (required)
        :param str snapshot_id: the ID of the snapshot to rollback to (required)
        :param int timeout: The timeout of the operation
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_snapshot_rollback_with_http_info(scope_id, device_id, snapshot_id, **kwargs)  # noqa: E501
        else:
            (data) = self.device_snapshot_rollback_with_http_info(scope_id, device_id, snapshot_id, **kwargs)  # noqa: E501
            return data

    def device_snapshot_rollback_with_http_info(self, scope_id, device_id, snapshot_id, **kwargs):  # noqa: E501
        """Gets a list of snapshots  # noqa: E501

        Updates the configuration of a device rolling back a given snapshot ID.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_snapshot_rollback_with_http_info(scope_id, device_id, snapshot_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the device (required)
        :param str device_id: The id of the device (required)
        :param str snapshot_id: the ID of the snapshot to rollback to (required)
        :param int timeout: The timeout of the operation
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'snapshot_id', 'timeout']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_snapshot_rollback" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_snapshot_rollback`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_snapshot_rollback`")  # noqa: E501
        # verify the required parameter 'snapshot_id' is set
        if ('snapshot_id' not in params or
                params['snapshot_id'] is None):
            raise ValueError("Missing the required parameter `snapshot_id` when calling `device_snapshot_rollback`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'snapshot_id' in params:
            path_params['snapshotId'] = params['snapshot_id']  # noqa: E501

        query_params = []
        if 'timeout' in params:
            query_params.append(('timeout', params['timeout']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}/snapshots/{snapshotId}/_rollback', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type=None,  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def device_update(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Update a Device  # noqa: E501

        Updates a new Device based on the information provided in the Device parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_update(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Device. (required)
        :param str device_id: The id of the requested Device (required)
        :param Device body: The modified Device whose attributed need to be updated (required)
        :return: Device
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.device_update_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
        else:
            (data) = self.device_update_with_http_info(scope_id, device_id, body, **kwargs)  # noqa: E501
            return data

    def device_update_with_http_info(self, scope_id, device_id, body, **kwargs):  # noqa: E501
        """Update a Device  # noqa: E501

        Updates a new Device based on the information provided in the Device parameter.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.device_update_with_http_info(scope_id, device_id, body, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str scope_id: The ScopeId of the requested Device. (required)
        :param str device_id: The id of the requested Device (required)
        :param Device body: The modified Device whose attributed need to be updated (required)
        :return: Device
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['scope_id', 'device_id', 'body']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        params = locals()
        for key, val in six.iteritems(params['kwargs']):
            if key not in all_params:
                raise TypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method device_update" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'scope_id' is set
        if ('scope_id' not in params or
                params['scope_id'] is None):
            raise ValueError("Missing the required parameter `scope_id` when calling `device_update`")  # noqa: E501
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `device_update`")  # noqa: E501
        # verify the required parameter 'body' is set
        if ('body' not in params or
                params['body'] is None):
            raise ValueError("Missing the required parameter `body` when calling `device_update`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'scope_id' in params:
            path_params['scopeId'] = params['scope_id']  # noqa: E501
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = ['kapuaAccessToken']  # noqa: E501

        return self.api_client.call_api(
            '/{scopeId}/devices/{deviceId}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Device',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)
