# coding: utf-8

"""
    UUDEXApi

    uudex api  # noqa: E501

    OpenAPI spec version: 1.0
    Contact: jeff.welsh@pnnl.gov
    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 uudex_client.api_client import ApiClient


class SubscriptionApi(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 attach_subscription_subject(self, subscription_uuid, **kwargs):  # noqa: E501
        """Attach a single Subject to the given Subscription  # noqa: E501

        The invoker must own the Subscription.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.attach_subscription_subject(subscription_uuid, async_req=True)
        >>> result = thread.get()

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

    def attach_subscription_subject_with_http_info(self, subscription_uuid, **kwargs):  # noqa: E501
        """Attach a single Subject to the given Subscription  # noqa: E501

        The invoker must own the Subscription.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.attach_subscription_subject_with_http_info(subscription_uuid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str subscription_uuid: (required)
        :param SubscriptionSubject body:
        :return: SubscriptionSubject
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/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(
            '/subscriptions/{subscription_uuid}/subjects', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='SubscriptionSubject',  # 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 consume_subscription(self, subscription_uuid, **kwargs):  # noqa: E501
        """Consumes the subscription and returns one or more pending messages from message broker  # noqa: E501

        Invoker must have the SUBSCRIBE privilege on the the Subjects in the Subscription OR own the Subjects in the subscription.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.consume_subscription(subscription_uuid, async_req=True)
        >>> result = thread.get()

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

    def consume_subscription_with_http_info(self, subscription_uuid, **kwargs):  # noqa: E501
        """Consumes the subscription and returns one or more pending messages from message broker  # noqa: E501

        Invoker must have the SUBSCRIBE privilege on the the Subjects in the Subscription OR own the Subjects in the subscription.   # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.consume_subscription_with_http_info(subscription_uuid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str subscription_uuid: (required)
        :return: list[MessageConsumeResp]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'subscription_uuid' in params:
            path_params['subscription_uuid'] = params['subscription_uuid']  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/subscriptions/{subscription_uuid}/consume', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[MessageConsumeResp]',  # 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_subscription(self, **kwargs):  # noqa: E501
        """Create a single Subscription  # noqa: E501

        Create a single Subscription for the invoker.  # 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_subscription(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param Subscription body:
        :return: Subscription
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.create_subscription_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.create_subscription_with_http_info(**kwargs)  # noqa: E501
            return data

    def create_subscription_with_http_info(self, **kwargs):  # noqa: E501
        """Create a single Subscription  # noqa: E501

        Create a single Subscription for the invoker.  # 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_subscription_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param Subscription body:
        :return: Subscription
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/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(
            '/subscriptions', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Subscription',  # 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_subscription(self, subscription_uuid, **kwargs):  # noqa: E501
        """Delete a Subscription  # noqa: E501

        The invoker must own the Subscription.  # 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_subscription(subscription_uuid, async_req=True)
        >>> result = thread.get()

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

    def delete_subscription_with_http_info(self, subscription_uuid, **kwargs):  # noqa: E501
        """Delete a Subscription  # noqa: E501

        The invoker must own the Subscription.  # 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_subscription_with_http_info(subscription_uuid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str subscription_uuid: (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

    def detach_subscription_subject(self, subscription_uuid, subscription_subject_id, **kwargs):  # noqa: E501
        """Detach a Subject from the given Subscription  # noqa: E501

        The invoker must own the Subscription.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.detach_subscription_subject(subscription_uuid, subscription_subject_id, async_req=True)
        >>> result = thread.get()

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

    def detach_subscription_subject_with_http_info(self, subscription_uuid, subscription_subject_id, **kwargs):  # noqa: E501
        """Detach a Subject from the given Subscription  # noqa: E501

        The invoker must own the Subscription.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.detach_subscription_subject_with_http_info(subscription_uuid, subscription_subject_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str subscription_uuid: (required)
        :param str subscription_subject_id: (required)
        :return: None
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

    def get_subscription(self, subscription_uuid, **kwargs):  # noqa: E501
        """Gets a single Subscription  # noqa: E501

        The invoker must own the Subscription.  A UUDEX Admin may get any Subscription.  # 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_subscription(subscription_uuid, async_req=True)
        >>> result = thread.get()

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

    def get_subscription_with_http_info(self, subscription_uuid, **kwargs):  # noqa: E501
        """Gets a single Subscription  # noqa: E501

        The invoker must own the Subscription.  A UUDEX Admin may get any Subscription.  # 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_subscription_with_http_info(subscription_uuid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str subscription_uuid: (required)
        :return: Subscription
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'subscription_uuid' in params:
            path_params['subscription_uuid'] = params['subscription_uuid']  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/subscriptions/{subscription_uuid}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Subscription',  # 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_subscription_subjects(self, subscription_uuid, **kwargs):  # noqa: E501
        """Returns a collection of all Subjects attached to the given Subscription  # noqa: E501

        The invoker must own the Subscription.  A UUDEX Admin may get any Subscription's Subjects.  # 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_subscription_subjects(subscription_uuid, async_req=True)
        >>> result = thread.get()

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

    def get_subscription_subjects_with_http_info(self, subscription_uuid, **kwargs):  # noqa: E501
        """Returns a collection of all Subjects attached to the given Subscription  # noqa: E501

        The invoker must own the Subscription.  A UUDEX Admin may get any Subscription's Subjects.  # 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_subscription_subjects_with_http_info(subscription_uuid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str subscription_uuid: (required)
        :return: list[SubscriptionSubject]
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}
        if 'subscription_uuid' in params:
            path_params['subscription_uuid'] = params['subscription_uuid']  # 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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/subscriptions/{subscription_uuid}/subjects', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[SubscriptionSubject]',  # 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_subscriptions(self, **kwargs):  # noqa: E501
        """Returns a collection of the invoker's Subscriptions  # noqa: E501

        The invoker must own the Subscription.  A UUDEX Admin will get a collection of all Subscriptions in the system.  # 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_subscriptions(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: list[SubscriptionEnriched]
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_subscriptions_with_http_info(**kwargs)  # noqa: E501
        else:
            (data) = self.get_subscriptions_with_http_info(**kwargs)  # noqa: E501
            return data

    def get_subscriptions_with_http_info(self, **kwargs):  # noqa: E501
        """Returns a collection of the invoker's Subscriptions  # noqa: E501

        The invoker must own the Subscription.  A UUDEX Admin will get a collection of all Subscriptions in the system.  # 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_subscriptions_with_http_info(async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :return: list[SubscriptionEnriched]
                 If the method is called asynchronously,
                 returns the request thread.
        """

        all_params = []  # 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_subscriptions" % key
                )
            params[key] = val
        del params['kwargs']

        collection_formats = {}

        path_params = {}

        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

        # Authentication setting
        auth_settings = []  # noqa: E501

        return self.api_client.call_api(
            '/subscriptions', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[SubscriptionEnriched]',  # 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_subscription(self, subscription_uuid, **kwargs):  # noqa: E501
        """Update a single Subscription  # noqa: E501

        The invoker must own the Subscription.  # 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_subscription(subscription_uuid, async_req=True)
        >>> result = thread.get()

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

    def update_subscription_with_http_info(self, subscription_uuid, **kwargs):  # noqa: E501
        """Update a single Subscription  # noqa: E501

        The invoker must own the Subscription.  # 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_subscription_with_http_info(subscription_uuid, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str subscription_uuid: (required)
        :param Subscription body:
        :return: Subscription
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

        body_params = None
        if 'body' in params:
            body_params = params['body']
        # HTTP header `Accept`
        header_params['Accept'] = self.api_client.select_header_accept(
            ['application/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(
            '/subscriptions/{subscription_uuid}', 'PATCH',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='Subscription',  # 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)
