# coding: utf-8

"""
    SevOne API Documentation

    Supported endpoints by the new RESTful API  # noqa: E501

    OpenAPI spec version: 2.1.18, Hash: db562e6
    
    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 apply_device_rules(self, id, **kwargs):  # noqa: E501
        """Apply the rules for the specified device  # noqa: E501

        Applies device group and object group rules for the specified 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.apply_device_rules(id, async_req=True)
        >>> result = thread.get()

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

    def apply_device_rules_with_http_info(self, id, **kwargs):  # noqa: E501
        """Apply the rules for the specified device  # noqa: E501

        Applies device group and object group rules for the specified 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.apply_device_rules_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device (required)
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def create_device(self, device, **kwargs):  # noqa: E501
        """Create device  # noqa: E501

        Creates a new 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.create_device(device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateDeviceRequestDto device: Device request object (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_device_with_http_info(device, **kwargs)  # noqa: E501
        else:
            (data) = self.create_device_with_http_info(device, **kwargs)  # noqa: E501
            return data

    def create_device_with_http_info(self, device, **kwargs):  # noqa: E501
        """Create device  # noqa: E501

        Creates a new 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.create_device_with_http_info(device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateDeviceRequestDto device: Device request object (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def create_device1(self, device, **kwargs):  # noqa: E501
        """Create device  # noqa: E501

        Creates a new 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.create_device1(device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateDeviceRequestDto device: Device request object (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_device1_with_http_info(device, **kwargs)  # noqa: E501
        else:
            (data) = self.create_device1_with_http_info(device, **kwargs)  # noqa: E501
            return data

    def create_device1_with_http_info(self, device, **kwargs):  # noqa: E501
        """Create device  # noqa: E501

        Creates a new 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.create_device1_with_http_info(device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param CreateDeviceRequestDto device: Device request object (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def create_device_data(self, device_data, **kwargs):  # noqa: E501
        """Create device data  # noqa: E501

        Creates new device data  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_device_data(device_data, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param DeviceDescription device_data: Device data request object (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_device_data_with_http_info(device_data, **kwargs)  # noqa: E501
        else:
            (data) = self.create_device_data_with_http_info(device_data, **kwargs)  # noqa: E501
            return data

    def create_device_data_with_http_info(self, device_data, **kwargs):  # noqa: E501
        """Create device data  # noqa: E501

        Creates new device data  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.create_device_data_with_http_info(device_data, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param DeviceDescription device_data: Device data request object (required)
        :return: str
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def delete_device_by_id(self, id, **kwargs):  # noqa: E501
        """Delete device  # noqa: E501

        Deletes an existing 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.delete_device_by_id(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be deleted (required)
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_device_by_id_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_device_by_id_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def delete_device_by_id_with_http_info(self, id, **kwargs):  # noqa: E501
        """Delete device  # noqa: E501

        Deletes an existing 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.delete_device_by_id_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be deleted (required)
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def delete_device_by_id1(self, id, **kwargs):  # noqa: E501
        """Delete device  # noqa: E501

        Deletes an existing 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.delete_device_by_id1(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be deleted (required)
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.delete_device_by_id1_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.delete_device_by_id1_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def delete_device_by_id1_with_http_info(self, id, **kwargs):  # noqa: E501
        """Delete device  # noqa: E501

        Deletes an existing 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.delete_device_by_id1_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be deleted (required)
        :return: ResponseEntity
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def filter_device(self, filter, **kwargs):  # noqa: E501
        """Filter devices  # noqa: E501

        Find all devices that match the criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filter_device(filter, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param DeviceFilter filter: Device object that will be used for filtering (required)
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_objects: Determines whether to include objects
        :param bool include_indicators: Determines whether to include indicators
        :param bool include_extended_info: Determines whether to include extendedInfo or not
        :param bool local_only: Determines whether to execute distributed request or not
        :return: PagerDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.filter_device_with_http_info(filter, **kwargs)  # noqa: E501
        else:
            (data) = self.filter_device_with_http_info(filter, **kwargs)  # noqa: E501
            return data

    def filter_device_with_http_info(self, filter, **kwargs):  # noqa: E501
        """Filter devices  # noqa: E501

        Find all devices that match the criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filter_device_with_http_info(filter, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param DeviceFilter filter: Device object that will be used for filtering (required)
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_objects: Determines whether to include objects
        :param bool include_indicators: Determines whether to include indicators
        :param bool include_extended_info: Determines whether to include extendedInfo or not
        :param bool local_only: Determines whether to execute distributed request or not
        :return: PagerDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['filter', 'page', 'size', 'include_objects', 'include_indicators', 'include_extended_info', 'local_only']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'size' in params:
            query_params.append(('size', params['size']))  # noqa: E501
        if 'include_objects' in params:
            query_params.append(('includeObjects', params['include_objects']))  # noqa: E501
        if 'include_indicators' in params:
            query_params.append(('includeIndicators', params['include_indicators']))  # noqa: E501
        if 'include_extended_info' in params:
            query_params.append(('includeExtendedInfo', params['include_extended_info']))  # noqa: E501
        if 'local_only' in params:
            query_params.append(('localOnly', params['local_only']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def filter_device1(self, filter, **kwargs):  # noqa: E501
        """Filter devices  # noqa: E501

        Find all devices that match the criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filter_device1(filter, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param DeviceFilter filter: Device object that will be used for filtering (required)
        :param bool include_objects: Determines whether to include objects
        :param bool include_indicators: Determines whether to include indicators
        :param bool include_extended_info: Determines whether to include extendedInfo or not
        :param bool local_only: Determines whether to execute distributed request or not
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_count: Whether to query for total elements count; defaults to true, set to false for performance boost
        :param str sort_by: String array of format \"parameter, -parameter, natural\\*parameter, -natural\\*parameter\", where minus is for descending, natural* is for natural sort
        :param str fields: String array of format \"id,name,objects(id,pluginId)\"; Defines which fields are returned 
        :return: PagerDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.filter_device1_with_http_info(filter, **kwargs)  # noqa: E501
        else:
            (data) = self.filter_device1_with_http_info(filter, **kwargs)  # noqa: E501
            return data

    def filter_device1_with_http_info(self, filter, **kwargs):  # noqa: E501
        """Filter devices  # noqa: E501

        Find all devices that match the criteria  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.filter_device1_with_http_info(filter, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param DeviceFilter filter: Device object that will be used for filtering (required)
        :param bool include_objects: Determines whether to include objects
        :param bool include_indicators: Determines whether to include indicators
        :param bool include_extended_info: Determines whether to include extendedInfo or not
        :param bool local_only: Determines whether to execute distributed request or not
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_count: Whether to query for total elements count; defaults to true, set to false for performance boost
        :param str sort_by: String array of format \"parameter, -parameter, natural\\*parameter, -natural\\*parameter\", where minus is for descending, natural* is for natural sort
        :param str fields: String array of format \"id,name,objects(id,pluginId)\"; Defines which fields are returned 
        :return: PagerDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['filter', 'include_objects', 'include_indicators', 'include_extended_info', 'local_only', 'page', 'size', 'include_count', 'sort_by', 'fields']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'include_objects' in params:
            query_params.append(('includeObjects', params['include_objects']))  # noqa: E501
        if 'include_indicators' in params:
            query_params.append(('includeIndicators', params['include_indicators']))  # noqa: E501
        if 'include_extended_info' in params:
            query_params.append(('includeExtendedInfo', params['include_extended_info']))  # noqa: E501
        if 'local_only' in params:
            query_params.append(('localOnly', params['local_only']))  # noqa: E501
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'size' in params:
            query_params.append(('size', params['size']))  # noqa: E501
        if 'include_count' in params:
            query_params.append(('includeCount', params['include_count']))  # noqa: E501
        if 'sort_by' in params:
            query_params.append(('sortBy', params['sort_by']))  # noqa: E501
        if 'fields' in params:
            query_params.append(('fields', params['fields']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def get_device_by_id(self, id, **kwargs):  # noqa: E501
        """Get device by Id  # noqa: E501

        Gets a single device object by provided Id if it exists  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_device_by_id(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the requested device (required)
        :param bool include_objects: Determines whether to include objects of the device
        :param bool include_indicators: Determines whether to include indicators and objects
        :param bool include_extended_info: Determines whether to include extendedInfo or not
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_device_by_id_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_device_by_id_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def get_device_by_id_with_http_info(self, id, **kwargs):  # noqa: E501
        """Get device by Id  # noqa: E501

        Gets a single device object by provided Id if it exists  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_device_by_id_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the requested device (required)
        :param bool include_objects: Determines whether to include objects of the device
        :param bool include_indicators: Determines whether to include indicators and objects
        :param bool include_extended_info: Determines whether to include extendedInfo or not
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'include_objects', 'include_indicators', 'include_extended_info']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

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

        query_params = []
        if 'include_objects' in params:
            query_params.append(('includeObjects', params['include_objects']))  # noqa: E501
        if 'include_indicators' in params:
            query_params.append(('includeIndicators', params['include_indicators']))  # noqa: E501
        if 'include_extended_info' in params:
            query_params.append(('includeExtendedInfo', params['include_extended_info']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def get_device_by_id1(self, id, **kwargs):  # noqa: E501
        """Get device by Id  # noqa: E501

        Gets a single device object by provided Id if it exists  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_device_by_id1(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the requested device (required)
        :param bool include_objects: Determines whether to include objects of the device
        :param bool include_indicators: Determines whether to include indicators and objects
        :param bool include_extended_info: Determines whether to include extendedInfo or not
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_device_by_id1_with_http_info(id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_device_by_id1_with_http_info(id, **kwargs)  # noqa: E501
            return data

    def get_device_by_id1_with_http_info(self, id, **kwargs):  # noqa: E501
        """Get device by Id  # noqa: E501

        Gets a single device object by provided Id if it exists  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_device_by_id1_with_http_info(id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the requested device (required)
        :param bool include_objects: Determines whether to include objects of the device
        :param bool include_indicators: Determines whether to include indicators and objects
        :param bool include_extended_info: Determines whether to include extendedInfo or not
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['id', 'include_objects', 'include_indicators', 'include_extended_info']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

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

        query_params = []
        if 'include_objects' in params:
            query_params.append(('includeObjects', params['include_objects']))  # noqa: E501
        if 'include_indicators' in params:
            query_params.append(('includeIndicators', params['include_indicators']))  # noqa: E501
        if 'include_extended_info' in params:
            query_params.append(('includeExtendedInfo', params['include_extended_info']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def get_devices(self, **kwargs):  # noqa: E501
        """Get all devices  # noqa: E501

        Endpoint for retrieving all devices that supports pagination  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_devices(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :return: PagerDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_devices_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_devices_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_devices_with_http_info(self, **kwargs):  # noqa: E501
        """Get all devices  # noqa: E501

        Endpoint for retrieving all devices that supports pagination  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_devices_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :return: PagerDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}

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

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def get_devices1(self, **kwargs):  # noqa: E501
        """Get all devices  # noqa: E501

        Endpoint for retrieving all devices that supports pagination  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_devices1(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_count: Whether to query for total elements count; defaults to true, set to false for performance boost
        :param str sort_by: String array of format \"parameter, -parameter, natural\\*parameter, -natural\\*parameter\", where minus is for descending, natural* is for natural sort
        :param str fields: String array of format \"id,name,objects(id,pluginId)\"; Defines which fields are returned 
        :return: PagerDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_devices1_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_devices1_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_devices1_with_http_info(self, **kwargs):  # noqa: E501
        """Get all devices  # noqa: E501

        Endpoint for retrieving all devices that supports pagination  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_devices1_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int page: The number of the requested page, defaults to 0
        :param int size: The size of the requested page, defaults to 20; limited to a configurable maximum (10000 by default)
        :param bool include_count: Whether to query for total elements count; defaults to true, set to false for performance boost
        :param str sort_by: String array of format \"parameter, -parameter, natural\\*parameter, -natural\\*parameter\", where minus is for descending, natural* is for natural sort
        :param str fields: String array of format \"id,name,objects(id,pluginId)\"; Defines which fields are returned 
        :return: PagerDeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['page', 'size', 'include_count', 'sort_by', 'fields']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'page' in params:
            query_params.append(('page', params['page']))  # noqa: E501
        if 'size' in params:
            query_params.append(('size', params['size']))  # noqa: E501
        if 'include_count' in params:
            query_params.append(('includeCount', params['include_count']))  # noqa: E501
        if 'sort_by' in params:
            query_params.append(('sortBy', params['sort_by']))  # noqa: E501
        if 'fields' in params:
            query_params.append(('fields', params['fields']))  # noqa: E501

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def partially_update_device_by_id(self, id, device, **kwargs):  # noqa: E501
        """Partially update device  # noqa: E501

        Partial update an existing 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.partially_update_device_by_id(id, device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be updated (required)
        :param DeviceUpdateRequestDto device: Device to be updated (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.partially_update_device_by_id_with_http_info(id, device, **kwargs)  # noqa: E501
        else:
            (data) = self.partially_update_device_by_id_with_http_info(id, device, **kwargs)  # noqa: E501
            return data

    def partially_update_device_by_id_with_http_info(self, id, device, **kwargs):  # noqa: E501
        """Partially update device  # noqa: E501

        Partial update an existing 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.partially_update_device_by_id_with_http_info(id, device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be updated (required)
        :param DeviceUpdateRequestDto device: Device to be updated (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def partially_update_device_by_id1(self, id, device, **kwargs):  # noqa: E501
        """Partially update device  # noqa: E501

        Partial update an existing 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.partially_update_device_by_id1(id, device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be updated (required)
        :param DeviceUpdateRequestDto device: Device to be updated (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.partially_update_device_by_id1_with_http_info(id, device, **kwargs)  # noqa: E501
        else:
            (data) = self.partially_update_device_by_id1_with_http_info(id, device, **kwargs)  # noqa: E501
            return data

    def partially_update_device_by_id1_with_http_info(self, id, device, **kwargs):  # noqa: E501
        """Partially update device  # noqa: E501

        Partial update an existing 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.partially_update_device_by_id1_with_http_info(id, device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be updated (required)
        :param DeviceUpdateRequestDto device: Device to be updated (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def update_device_by_id(self, id, device, **kwargs):  # noqa: E501
        """Update device  # noqa: E501

        Updates an existing 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.update_device_by_id(id, device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be updated (required)
        :param DeviceUpdateRequestDto device: Device to be updated (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_device_by_id_with_http_info(id, device, **kwargs)  # noqa: E501
        else:
            (data) = self.update_device_by_id_with_http_info(id, device, **kwargs)  # noqa: E501
            return data

    def update_device_by_id_with_http_info(self, id, device, **kwargs):  # noqa: E501
        """Update device  # noqa: E501

        Updates an existing 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.update_device_by_id_with_http_info(id, device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be updated (required)
        :param DeviceUpdateRequestDto device: Device to be updated (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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

    def update_device_by_id1(self, id, device, **kwargs):  # noqa: E501
        """Update device  # noqa: E501

        Updates an existing 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.update_device_by_id1(id, device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be updated (required)
        :param DeviceUpdateRequestDto device: Device to be updated (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_device_by_id1_with_http_info(id, device, **kwargs)  # noqa: E501
        else:
            (data) = self.update_device_by_id1_with_http_info(id, device, **kwargs)  # noqa: E501
            return data

    def update_device_by_id1_with_http_info(self, id, device, **kwargs):  # noqa: E501
        """Update device  # noqa: E501

        Updates an existing 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.update_device_by_id1_with_http_info(id, device, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int id: The id of the device to be updated (required)
        :param DeviceUpdateRequestDto device: Device to be updated (required)
        :return: DeviceDto
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

        # Authentication setting
        auth_settings = []  # noqa: E501

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