# coding: utf-8

"""
    Marketing API v.1.0

    IMPORTANT: This swagger links to Criteo production environment. Any test applied here will thus impact real campaigns.  # noqa: E501

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


from __future__ import absolute_import

import re  # noqa: F401

# python 2 and python 3 compatibility library
import six

from criteo_marketing.api_client import ApiClient
from criteo_marketing.exceptions import (
    ApiTypeError,
    ApiValueError
)


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

    Do not edit the class manually.
    """

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

    def add_remove_users_to_audience(self, audience_id, authorization, request, **kwargs):  # noqa: E501
        """Add/Remove users to an Audience.  # noqa: E501

        Add/Remove users to an Audience.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.add_remove_users_to_audience(audience_id, authorization, request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param int audience_id: Mandatory. The id of the audience to add or remove users to. (required)
        :param str authorization: JWT Bearer Token (required)
        :param AudiencePatchRequest request: Mandatory. The request to create the Audience. (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: AudiencePatchResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.add_remove_users_to_audience_with_http_info(audience_id, authorization, request, **kwargs)  # noqa: E501

    def add_remove_users_to_audience_with_http_info(self, audience_id, authorization, request, **kwargs):  # noqa: E501
        """Add/Remove users to an Audience.  # noqa: E501

        Add/Remove users to an Audience.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.add_remove_users_to_audience_with_http_info(audience_id, authorization, request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param int audience_id: Mandatory. The id of the audience to add or remove users to. (required)
        :param str authorization: JWT Bearer Token (required)
        :param AudiencePatchRequest request: Mandatory. The request to create the Audience. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(AudiencePatchResponse, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['audience_id', 'authorization', 'request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method add_remove_users_to_audience" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'audience_id' is set
        if ('audience_id' not in local_var_params or
                local_var_params['audience_id'] is None):
            raise ApiValueError("Missing the required parameter `audience_id` when calling `add_remove_users_to_audience`")  # noqa: E501
        # verify the required parameter 'authorization' is set
        if ('authorization' not in local_var_params or
                local_var_params['authorization'] is None):
            raise ApiValueError("Missing the required parameter `authorization` when calling `add_remove_users_to_audience`")  # noqa: E501
        # verify the required parameter 'request' is set
        if ('request' not in local_var_params or
                local_var_params['request'] is None):
            raise ApiValueError("Missing the required parameter `request` when calling `add_remove_users_to_audience`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'audience_id' in local_var_params:
            path_params['audienceId'] = local_var_params['audience_id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'authorization' in local_var_params:
            header_params['Authorization'] = local_var_params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/v1/audiences/userlist/{audienceId}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='AudiencePatchResponse',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def create_audience(self, authorization, create_request, **kwargs):  # noqa: E501
        """Create a new Audience.  # noqa: E501

        Create a new Audience for the given Advertiser.  # 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_audience(authorization, create_request, async_req=True)
        >>> result = thread.get()

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

    def create_audience_with_http_info(self, authorization, create_request, **kwargs):  # noqa: E501
        """Create a new Audience.  # noqa: E501

        Create a new Audience for the given Advertiser.  # 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_audience_with_http_info(authorization, create_request, async_req=True)
        >>> result = thread.get()

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

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}
        if 'authorization' in local_var_params:
            header_params['Authorization'] = local_var_params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}

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

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

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

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

    def delete_audience(self, audience_id, authorization, **kwargs):  # noqa: E501
        """Delete an Audience.  # noqa: E501

        Delete an Audience.  # 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_audience(audience_id, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param int audience_id: Mandatory. The id of the audience to delete. (required)
        :param str authorization: JWT Bearer Token (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.delete_audience_with_http_info(audience_id, authorization, **kwargs)  # noqa: E501

    def delete_audience_with_http_info(self, audience_id, authorization, **kwargs):  # noqa: E501
        """Delete an Audience.  # noqa: E501

        Delete an Audience.  # 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_audience_with_http_info(audience_id, authorization, async_req=True)
        >>> result = thread.get()

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

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'audience_id' in local_var_params:
            path_params['audienceId'] = local_var_params['audience_id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'authorization' in local_var_params:
            header_params['Authorization'] = local_var_params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}

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

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

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

    def get_audiences(self, authorization, **kwargs):  # noqa: E501
        """Get the list of Audiences.  # noqa: E501

        Get the list of Audiences for the given Advertiser.  # 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_audiences(authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param str authorization: JWT Bearer Token (required)
        :param int advertiser_id: Mandatory. Advertiser to get all Audiences for.
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: AudiencesGetResponse
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.get_audiences_with_http_info(authorization, **kwargs)  # noqa: E501

    def get_audiences_with_http_info(self, authorization, **kwargs):  # noqa: E501
        """Get the list of Audiences.  # noqa: E501

        Get the list of Audiences for the given Advertiser.  # 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_audiences_with_http_info(authorization, async_req=True)
        >>> result = thread.get()

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

        local_var_params = locals()

        all_params = ['authorization', 'advertiser_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')

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'advertiser_id' in local_var_params:
            query_params.append(('advertiserId', local_var_params['advertiser_id']))  # noqa: E501

        header_params = {}
        if 'authorization' in local_var_params:
            header_params['Authorization'] = local_var_params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}

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

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

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

    def remove_users_from_audience(self, audience_id, authorization, **kwargs):  # noqa: E501
        """Remove all users from an Audience.  # noqa: E501

        Remove all users from an Audience.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.remove_users_from_audience(audience_id, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param int audience_id: Mandatory. The id of the audience to empty. (required)
        :param str authorization: JWT Bearer Token (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.remove_users_from_audience_with_http_info(audience_id, authorization, **kwargs)  # noqa: E501

    def remove_users_from_audience_with_http_info(self, audience_id, authorization, **kwargs):  # noqa: E501
        """Remove all users from an Audience.  # noqa: E501

        Remove all users from an Audience.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.remove_users_from_audience_with_http_info(audience_id, authorization, async_req=True)
        >>> result = thread.get()

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

        local_var_params = locals()

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

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

        collection_formats = {}

        path_params = {}
        if 'audience_id' in local_var_params:
            path_params['audienceId'] = local_var_params['audience_id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'authorization' in local_var_params:
            header_params['Authorization'] = local_var_params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}

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

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

        return self.api_client.call_api(
            '/v1/audiences/userlist/{audienceId}/users', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='object',  # noqa: E501
            auth_settings=auth_settings,
            async_req=local_var_params.get('async_req'),
            _return_http_data_only=local_var_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=local_var_params.get('_preload_content', True),
            _request_timeout=local_var_params.get('_request_timeout'),
            collection_formats=collection_formats)

    def update_audience_metadata(self, audience_id, authorization, request, **kwargs):  # noqa: E501
        """Update an Audience metadata.  # noqa: E501

        Update an Audience metadata.  # 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_audience_metadata(audience_id, authorization, request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param int audience_id: Mandatory. The id of the Audience to update. (required)
        :param str authorization: JWT Bearer Token (required)
        :param AudiencePutRequest request: Mandatory. The request to update the Audience metadata. (required)
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: object
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        return self.update_audience_metadata_with_http_info(audience_id, authorization, request, **kwargs)  # noqa: E501

    def update_audience_metadata_with_http_info(self, audience_id, authorization, request, **kwargs):  # noqa: E501
        """Update an Audience metadata.  # noqa: E501

        Update an Audience metadata.  # 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_audience_metadata_with_http_info(audience_id, authorization, request, async_req=True)
        >>> result = thread.get()

        :param async_req bool: execute request asynchronously
        :param int audience_id: Mandatory. The id of the Audience to update. (required)
        :param str authorization: JWT Bearer Token (required)
        :param AudiencePutRequest request: Mandatory. The request to update the Audience metadata. (required)
        :param _return_http_data_only: response data without head status code
                                       and headers
        :param _preload_content: if False, the urllib3.HTTPResponse object will
                                 be returned without reading/decoding response
                                 data. Default is True.
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :return: tuple(object, status_code(int), headers(HTTPHeaderDict))
                 If the method is called asynchronously,
                 returns the request thread.
        """

        local_var_params = locals()

        all_params = ['audience_id', 'authorization', 'request']  # noqa: E501
        all_params.append('async_req')
        all_params.append('_return_http_data_only')
        all_params.append('_preload_content')
        all_params.append('_request_timeout')

        for key, val in six.iteritems(local_var_params['kwargs']):
            if key not in all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_audience_metadata" % key
                )
            local_var_params[key] = val
        del local_var_params['kwargs']
        # verify the required parameter 'audience_id' is set
        if ('audience_id' not in local_var_params or
                local_var_params['audience_id'] is None):
            raise ApiValueError("Missing the required parameter `audience_id` when calling `update_audience_metadata`")  # noqa: E501
        # verify the required parameter 'authorization' is set
        if ('authorization' not in local_var_params or
                local_var_params['authorization'] is None):
            raise ApiValueError("Missing the required parameter `authorization` when calling `update_audience_metadata`")  # noqa: E501
        # verify the required parameter 'request' is set
        if ('request' not in local_var_params or
                local_var_params['request'] is None):
            raise ApiValueError("Missing the required parameter `request` when calling `update_audience_metadata`")  # noqa: E501

        collection_formats = {}

        path_params = {}
        if 'audience_id' in local_var_params:
            path_params['audienceId'] = local_var_params['audience_id']  # noqa: E501

        query_params = []

        header_params = {}
        if 'authorization' in local_var_params:
            header_params['Authorization'] = local_var_params['authorization']  # noqa: E501

        form_params = []
        local_var_files = {}

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

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

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

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