# 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 MetadataApi(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 get_metadata_value(self, entity_type, entity_id, **kwargs):  # noqa: E501
        """Get Metadata values  # noqa: E501

        This endpoint will get metadata value for entity type (device/object group/device group/object type/indicator type) and entity 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.get_metadata_value(entity_type, entity_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str entity_type: Entity Type (required)
        :param int entity_id: Entity Id (required)
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_metadata_value_with_http_info(entity_type, entity_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_metadata_value_with_http_info(entity_type, entity_id, **kwargs)  # noqa: E501
            return data

    def get_metadata_value_with_http_info(self, entity_type, entity_id, **kwargs):  # noqa: E501
        """Get Metadata values  # noqa: E501

        This endpoint will get metadata value for entity type (device/object group/device group/object type/indicator type) and entity 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.get_metadata_value_with_http_info(entity_type, entity_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str entity_type: Entity Type (required)
        :param int entity_id: Entity Id (required)
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}
        if 'entity_type' in params:
            path_params['entityType'] = params['entity_type']  # noqa: E501
        if 'entity_id' in params:
            path_params['entityId'] = params['entity_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

        # 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/{entityType}/{entityId}/metadata', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AttributeValues',  # 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_object_metadata_value(self, device_id, object_id, **kwargs):  # noqa: E501
        """Get Object Metadata value  # noqa: E501

        This endpoint will get metadata value for entity type (object) and entity 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.get_object_metadata_value(device_id, object_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int device_id: Device Id (required)
        :param int object_id: Object Id (required)
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_object_metadata_value_with_http_info(device_id, object_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_object_metadata_value_with_http_info(device_id, object_id, **kwargs)  # noqa: E501
            return data

    def get_object_metadata_value_with_http_info(self, device_id, object_id, **kwargs):  # noqa: E501
        """Get Object Metadata value  # noqa: E501

        This endpoint will get metadata value for entity type (object) and entity 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.get_object_metadata_value_with_http_info(device_id, object_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int device_id: Device Id (required)
        :param int object_id: Object Id (required)
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'object_id' in params:
            path_params['objectId'] = params['object_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/{deviceId}/objects/{objectId}/metadata', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AttributeValues',  # 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 partial_update_metadata(self, entity_type, entity_id, **kwargs):  # noqa: E501
        """Partially update Metadata Attributes  # noqa: E501

        This endpoint will update the provided metadata values for this entity type  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.partial_update_metadata(entity_type, entity_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str entity_type: Entity Type (required)
        :param int entity_id: Entity Id (required)
        :param object values: Type of the param is `Map<String, AttributeValues>`, the string key consists of 'namespacename.attributename'
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.partial_update_metadata_with_http_info(entity_type, entity_id, **kwargs)  # noqa: E501
        else:
            (data) = self.partial_update_metadata_with_http_info(entity_type, entity_id, **kwargs)  # noqa: E501
            return data

    def partial_update_metadata_with_http_info(self, entity_type, entity_id, **kwargs):  # noqa: E501
        """Partially update Metadata Attributes  # noqa: E501

        This endpoint will update the provided metadata values for this entity type  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.partial_update_metadata_with_http_info(entity_type, entity_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str entity_type: Entity Type (required)
        :param int entity_id: Entity Id (required)
        :param object values: Type of the param is `Map<String, AttributeValues>`, the string key consists of 'namespacename.attributename'
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['entity_type', 'entity_id', 'values']  # 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 partial_update_metadata" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'entity_type' is set
        if ('entity_type' not in params or
                params['entity_type'] is None):
            raise ValueError("Missing the required parameter `entity_type` when calling `partial_update_metadata`")  # noqa: E501
        # verify the required parameter 'entity_id' is set
        if ('entity_id' not in params or
                params['entity_id'] is None):
            raise ValueError("Missing the required parameter `entity_id` when calling `partial_update_metadata`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'entity_type' in params:
            path_params['entityType'] = params['entity_type']  # noqa: E501
        if 'entity_id' in params:
            path_params['entityId'] = params['entity_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'values' in params:
            body_params = params['values']
        # 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/{entityType}/{entityId}/metadata', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AttributeValues',  # 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 partial_update_metadata1(self, device_id, object_id, **kwargs):  # noqa: E501
        """Partially update Metadata Attributes  # noqa: E501

        This endpoint will update the provided metadata values for this object  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.partial_update_metadata1(device_id, object_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int device_id: Device Id (required)
        :param int object_id: Object Id (required)
        :param object values: Type of the param is `Map<String, AttributeValues>`, the string key consists of 'namespacename.attributename'
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.partial_update_metadata1_with_http_info(device_id, object_id, **kwargs)  # noqa: E501
        else:
            (data) = self.partial_update_metadata1_with_http_info(device_id, object_id, **kwargs)  # noqa: E501
            return data

    def partial_update_metadata1_with_http_info(self, device_id, object_id, **kwargs):  # noqa: E501
        """Partially update Metadata Attributes  # noqa: E501

        This endpoint will update the provided metadata values for this object  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.partial_update_metadata1_with_http_info(device_id, object_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int device_id: Device Id (required)
        :param int object_id: Object Id (required)
        :param object values: Type of the param is `Map<String, AttributeValues>`, the string key consists of 'namespacename.attributename'
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['device_id', 'object_id', 'values']  # 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 partial_update_metadata1" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `partial_update_metadata1`")  # noqa: E501
        # verify the required parameter 'object_id' is set
        if ('object_id' not in params or
                params['object_id'] is None):
            raise ValueError("Missing the required parameter `object_id` when calling `partial_update_metadata1`")  # noqa: E501

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'values' in params:
            body_params = params['values']
        # 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/{deviceId}/objects/{objectId}/metadata', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AttributeValues',  # 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_metadata(self, entity_type, entity_id, **kwargs):  # noqa: E501
        """Update Metadata Attributes  # noqa: E501

        This endpoint will delete all metadata values for this entity type and will create the values provided  # 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_metadata(entity_type, entity_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str entity_type: Entity Type (required)
        :param int entity_id: Entity Id (required)
        :param object values: Type of the param is `Map<String, AttributeValues>`, the string key consists of 'namespacename.attributename'
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_metadata_with_http_info(entity_type, entity_id, **kwargs)  # noqa: E501
        else:
            (data) = self.update_metadata_with_http_info(entity_type, entity_id, **kwargs)  # noqa: E501
            return data

    def update_metadata_with_http_info(self, entity_type, entity_id, **kwargs):  # noqa: E501
        """Update Metadata Attributes  # noqa: E501

        This endpoint will delete all metadata values for this entity type and will create the values provided  # 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_metadata_with_http_info(entity_type, entity_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str entity_type: Entity Type (required)
        :param int entity_id: Entity Id (required)
        :param object values: Type of the param is `Map<String, AttributeValues>`, the string key consists of 'namespacename.attributename'
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['entity_type', 'entity_id', 'values']  # 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_metadata" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'entity_type' is set
        if ('entity_type' not in params or
                params['entity_type'] is None):
            raise ValueError("Missing the required parameter `entity_type` when calling `update_metadata`")  # noqa: E501
        # verify the required parameter 'entity_id' is set
        if ('entity_id' not in params or
                params['entity_id'] is None):
            raise ValueError("Missing the required parameter `entity_id` when calling `update_metadata`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'entity_type' in params:
            path_params['entityType'] = params['entity_type']  # noqa: E501
        if 'entity_id' in params:
            path_params['entityId'] = params['entity_id']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'values' in params:
            body_params = params['values']
        # 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/{entityType}/{entityId}/metadata', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AttributeValues',  # 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_metadata1(self, device_id, object_id, **kwargs):  # noqa: E501
        """Update Metadata Attributes  # noqa: E501

        This endpoint will delete all metadata values for this object and will create the values provided  # 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_metadata1(device_id, object_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int device_id: Device Id (required)
        :param int object_id: Object Id (required)
        :param object values: Type of the param is `Map<String, AttributeValues>`, the string key consists of 'namespacename.attributename'
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_metadata1_with_http_info(device_id, object_id, **kwargs)  # noqa: E501
        else:
            (data) = self.update_metadata1_with_http_info(device_id, object_id, **kwargs)  # noqa: E501
            return data

    def update_metadata1_with_http_info(self, device_id, object_id, **kwargs):  # noqa: E501
        """Update Metadata Attributes  # noqa: E501

        This endpoint will delete all metadata values for this object and will create the values provided  # 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_metadata1_with_http_info(device_id, object_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int device_id: Device Id (required)
        :param int object_id: Object Id (required)
        :param object values: Type of the param is `Map<String, AttributeValues>`, the string key consists of 'namespacename.attributename'
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['device_id', 'object_id', 'values']  # 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_metadata1" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `update_metadata1`")  # noqa: E501
        # verify the required parameter 'object_id' is set
        if ('object_id' not in params or
                params['object_id'] is None):
            raise ValueError("Missing the required parameter `object_id` when calling `update_metadata1`")  # noqa: E501

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'values' in params:
            body_params = params['values']
        # 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/{deviceId}/objects/{objectId}/metadata', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AttributeValues',  # 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_metadata_by_attribute(self, entity_type, entity_id, attribute_key, values, **kwargs):  # noqa: E501
        """Update Metadata Attributes  # noqa: E501

        This endpoint will delete all metadata values for this entity type and attribute and will create the values provided  # 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_metadata_by_attribute(entity_type, entity_id, attribute_key, values, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str entity_type: Entity Type (required)
        :param int entity_id: Entity Id (required)
        :param str attribute_key: AttributeKey (required)
        :param AttributeValues values: values (required)
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_metadata_by_attribute_with_http_info(entity_type, entity_id, attribute_key, values, **kwargs)  # noqa: E501
        else:
            (data) = self.update_metadata_by_attribute_with_http_info(entity_type, entity_id, attribute_key, values, **kwargs)  # noqa: E501
            return data

    def update_metadata_by_attribute_with_http_info(self, entity_type, entity_id, attribute_key, values, **kwargs):  # noqa: E501
        """Update Metadata Attributes  # noqa: E501

        This endpoint will delete all metadata values for this entity type and attribute and will create the values provided  # 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_metadata_by_attribute_with_http_info(entity_type, entity_id, attribute_key, values, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str entity_type: Entity Type (required)
        :param int entity_id: Entity Id (required)
        :param str attribute_key: AttributeKey (required)
        :param AttributeValues values: values (required)
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['entity_type', 'entity_id', 'attribute_key', 'values']  # 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_metadata_by_attribute" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'entity_type' is set
        if ('entity_type' not in params or
                params['entity_type'] is None):
            raise ValueError("Missing the required parameter `entity_type` when calling `update_metadata_by_attribute`")  # noqa: E501
        # verify the required parameter 'entity_id' is set
        if ('entity_id' not in params or
                params['entity_id'] is None):
            raise ValueError("Missing the required parameter `entity_id` when calling `update_metadata_by_attribute`")  # noqa: E501
        # verify the required parameter 'attribute_key' is set
        if ('attribute_key' not in params or
                params['attribute_key'] is None):
            raise ValueError("Missing the required parameter `attribute_key` when calling `update_metadata_by_attribute`")  # noqa: E501
        # verify the required parameter 'values' is set
        if ('values' not in params or
                params['values'] is None):
            raise ValueError("Missing the required parameter `values` when calling `update_metadata_by_attribute`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'entity_type' in params:
            path_params['entityType'] = params['entity_type']  # noqa: E501
        if 'entity_id' in params:
            path_params['entityId'] = params['entity_id']  # noqa: E501
        if 'attribute_key' in params:
            path_params['attributeKey'] = params['attribute_key']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'values' in params:
            body_params = params['values']
        # 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/{entityType}/{entityId}/metadata/{attributeKey}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AttributeValues',  # 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_metadata_by_attribute1(self, device_id, object_id, attribute_key, values, **kwargs):  # noqa: E501
        """Update Metadata Attributes  # noqa: E501

        This endpoint will delete all metadata values for this object and attribute and will create the values provided  # 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_metadata_by_attribute1(device_id, object_id, attribute_key, values, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int device_id: Device Id (required)
        :param int object_id: Object Id (required)
        :param str attribute_key: AttributeKey (required)
        :param AttributeValues values: values (required)
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.update_metadata_by_attribute1_with_http_info(device_id, object_id, attribute_key, values, **kwargs)  # noqa: E501
        else:
            (data) = self.update_metadata_by_attribute1_with_http_info(device_id, object_id, attribute_key, values, **kwargs)  # noqa: E501
            return data

    def update_metadata_by_attribute1_with_http_info(self, device_id, object_id, attribute_key, values, **kwargs):  # noqa: E501
        """Update Metadata Attributes  # noqa: E501

        This endpoint will delete all metadata values for this object and attribute and will create the values provided  # 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_metadata_by_attribute1_with_http_info(device_id, object_id, attribute_key, values, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param int device_id: Device Id (required)
        :param int object_id: Object Id (required)
        :param str attribute_key: AttributeKey (required)
        :param AttributeValues values: values (required)
        :return: AttributeValues
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = ['device_id', 'object_id', 'attribute_key', 'values']  # 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_metadata_by_attribute1" % key
                )
            params[key] = val
        del params['kwargs']
        # verify the required parameter 'device_id' is set
        if ('device_id' not in params or
                params['device_id'] is None):
            raise ValueError("Missing the required parameter `device_id` when calling `update_metadata_by_attribute1`")  # noqa: E501
        # verify the required parameter 'object_id' is set
        if ('object_id' not in params or
                params['object_id'] is None):
            raise ValueError("Missing the required parameter `object_id` when calling `update_metadata_by_attribute1`")  # noqa: E501
        # verify the required parameter 'attribute_key' is set
        if ('attribute_key' not in params or
                params['attribute_key'] is None):
            raise ValueError("Missing the required parameter `attribute_key` when calling `update_metadata_by_attribute1`")  # noqa: E501
        # verify the required parameter 'values' is set
        if ('values' not in params or
                params['values'] is None):
            raise ValueError("Missing the required parameter `values` when calling `update_metadata_by_attribute1`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'device_id' in params:
            path_params['deviceId'] = params['device_id']  # noqa: E501
        if 'object_id' in params:
            path_params['objectId'] = params['object_id']  # noqa: E501
        if 'attribute_key' in params:
            path_params['attributeKey'] = params['attribute_key']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'values' in params:
            body_params = params['values']
        # 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/{deviceId}/objects/{objectId}/metadata/{attributeKey}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AttributeValues',  # 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)
