# coding: utf-8

"""
    Karbon Platform Services API reference.

    OpenAPI documentation for public facing Karbon Platform Services API  This API documentation is generated from source code using go-swagger. Do not edit the generated kps_api.json directly!  # noqa: E501

    OpenAPI spec version: 1.0
    Contact: karbon-platform-services-api@nutanix.com
    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 kps_api.api_client import ApiClient


class ApplicationApi(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 application_create_v2(self, body, authorization, **kwargs):  # noqa: E501
        """Create an application.  # noqa: E501

        Create an application.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.application_create_v2(body, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ApplicationV2 body: Describes the application creation request. (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: CreateDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.application_create_v2_with_http_info(body, authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.application_create_v2_with_http_info(body, authorization, **kwargs)  # noqa: E501
            return data

    def application_create_v2_with_http_info(self, body, authorization, **kwargs):  # noqa: E501
        """Create an application.  # noqa: E501

        Create an application.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.application_create_v2_with_http_info(body, authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ApplicationV2 body: Describes the application creation request. (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :return: CreateDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

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

        collection_formats = {}

        path_params = {}

        query_params = []

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

        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 = ['BearerToken']  # noqa: E501

        return self.api_client.call_api(
            '/v1.0/applications', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='CreateDocumentResponseV2',  # 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 application_delete_v2(self, authorization, id, **kwargs):  # noqa: E501
        """Delete application specified by the application ID.  # noqa: E501

        Deletes the application with the given ID {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.application_delete_v2(authorization, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :return: DeleteDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.application_delete_v2_with_http_info(authorization, id, **kwargs)  # noqa: E501
        else:
            (data) = self.application_delete_v2_with_http_info(authorization, id, **kwargs)  # noqa: E501
            return data

    def application_delete_v2_with_http_info(self, authorization, id, **kwargs):  # noqa: E501
        """Delete application specified by the application ID.  # noqa: E501

        Deletes the application with the given ID {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.application_delete_v2_with_http_info(authorization, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :return: DeleteDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}
        if 'authorization' in params:
            header_params['Authorization'] = 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'])  # noqa: E501

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

        return self.api_client.call_api(
            '/v1.0/applications/{id}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='DeleteDocumentResponseV2',  # 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 application_get_v2(self, authorization, id, **kwargs):  # noqa: E501
        """Get application by application ID.  # noqa: E501

        Retrieves the application with the given ID {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.application_get_v2(authorization, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :return: ApplicationV2
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.application_get_v2_with_http_info(authorization, id, **kwargs)  # noqa: E501
        else:
            (data) = self.application_get_v2_with_http_info(authorization, id, **kwargs)  # noqa: E501
            return data

    def application_get_v2_with_http_info(self, authorization, id, **kwargs):  # noqa: E501
        """Get application by application ID.  # noqa: E501

        Retrieves the application with the given ID {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.application_get_v2_with_http_info(authorization, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :return: ApplicationV2
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}
        if 'authorization' in params:
            header_params['Authorization'] = 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'])  # noqa: E501

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

        return self.api_client.call_api(
            '/v1.0/applications/{id}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ApplicationV2',  # 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 application_list_v2(self, authorization, **kwargs):  # noqa: E501
        """Get all applications.  # noqa: E501

        Retrieves a list of all applications.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.application_list_v2(authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param int page_index: 0-based index of the page to fetch results.
        :param int page_size: Item count of each page.
        :param list[str] order_by: Specify result order. Zero or more entries with format: &ltkey> [desc] where orderByKeys lists allowed keys in each response.
        :param str filter: Specify result filter. Format is similar to a SQL WHERE clause. For example, to filter object by name with prefix foo, use: name LIKE 'foo%'. Supported filter keys are the same as order by keys.
        :return: ApplicationListResponsePayload
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.application_list_v2_with_http_info(authorization, **kwargs)  # noqa: E501
        else:
            (data) = self.application_list_v2_with_http_info(authorization, **kwargs)  # noqa: E501
            return data

    def application_list_v2_with_http_info(self, authorization, **kwargs):  # noqa: E501
        """Get all applications.  # noqa: E501

        Retrieves a list of all applications.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.application_list_v2_with_http_info(authorization, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param int page_index: 0-based index of the page to fetch results.
        :param int page_size: Item count of each page.
        :param list[str] order_by: Specify result order. Zero or more entries with format: &ltkey> [desc] where orderByKeys lists allowed keys in each response.
        :param str filter: Specify result filter. Format is similar to a SQL WHERE clause. For example, to filter object by name with prefix foo, use: name LIKE 'foo%'. Supported filter keys are the same as order by keys.
        :return: ApplicationListResponsePayload
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

        path_params = {}

        query_params = []
        if 'page_index' in params:
            query_params.append(('pageIndex', params['page_index']))  # noqa: E501
        if 'page_size' in params:
            query_params.append(('pageSize', params['page_size']))  # noqa: E501
        if 'order_by' in params:
            query_params.append(('orderBy', params['order_by']))  # noqa: E501
            collection_formats['orderBy'] = 'csv'  # noqa: E501
        if 'filter' in params:
            query_params.append(('filter', params['filter']))  # noqa: E501

        header_params = {}
        if 'authorization' in params:
            header_params['Authorization'] = 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'])  # noqa: E501

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

        return self.api_client.call_api(
            '/v1.0/applications', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ApplicationListResponsePayload',  # 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 application_update_v3(self, body, authorization, id, **kwargs):  # noqa: E501
        """Update a specific application with ID {id}.  # noqa: E501

        Update a specific application with ID {id}. You cannot change the project associated with the application or the application ID. You can change all other attributes.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.application_update_v3(body, authorization, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ApplicationV2 body: (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :return: UpdateDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.application_update_v3_with_http_info(body, authorization, id, **kwargs)  # noqa: E501
        else:
            (data) = self.application_update_v3_with_http_info(body, authorization, id, **kwargs)  # noqa: E501
            return data

    def application_update_v3_with_http_info(self, body, authorization, id, **kwargs):  # noqa: E501
        """Update a specific application with ID {id}.  # noqa: E501

        Update a specific application with ID {id}. You cannot change the project associated with the application or the application ID. You can change all other attributes.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.application_update_v3_with_http_info(body, authorization, id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param ApplicationV2 body: (required)
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :return: UpdateDocumentResponseV2
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

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

        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 = ['BearerToken']  # noqa: E501

        return self.api_client.call_api(
            '/v1.0/applications/{id}', 'PUT',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='UpdateDocumentResponseV2',  # 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_application_containers(self, authorization, id, edge_id, **kwargs):  # noqa: E501
        """Get containers of an application specified by Application ID running on a specific edge.  # noqa: E501

        Gets the containers of an application with the given ID {id} running on edge with id {edgeId}.  # 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_application_containers(authorization, id, edge_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :param str edge_id: ID for the edge (required)
        :return: ApplicationContainers
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.get_application_containers_with_http_info(authorization, id, edge_id, **kwargs)  # noqa: E501
        else:
            (data) = self.get_application_containers_with_http_info(authorization, id, edge_id, **kwargs)  # noqa: E501
            return data

    def get_application_containers_with_http_info(self, authorization, id, edge_id, **kwargs):  # noqa: E501
        """Get containers of an application specified by Application ID running on a specific edge.  # noqa: E501

        Gets the containers of an application with the given ID {id} running on edge with id {edgeId}.  # 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_application_containers_with_http_info(authorization, id, edge_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str id: ID of the entity (required)
        :param str edge_id: ID for the edge (required)
        :return: ApplicationContainers
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []

        header_params = {}
        if 'authorization' in params:
            header_params['Authorization'] = 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'])  # noqa: E501

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

        return self.api_client.call_api(
            '/v1.0/applications/{id}/containers/{edgeId}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ApplicationContainers',  # 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 project_get_applications_v2(self, authorization, project_id, **kwargs):  # noqa: E501
        """Get all applications in a project according to project ID.  # noqa: E501

        Retrieves a list of all applications in a project with ID {projectId}.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.project_get_applications_v2(authorization, project_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str project_id: ID for the project (required)
        :param int page_index: 0-based index of the page to fetch results.
        :param int page_size: Item count of each page.
        :param list[str] order_by: Specify result order. Zero or more entries with format: &ltkey> [desc] where orderByKeys lists allowed keys in each response.
        :param str filter: Specify result filter. Format is similar to a SQL WHERE clause. For example, to filter object by name with prefix foo, use: name LIKE 'foo%'. Supported filter keys are the same as order by keys.
        :return: ApplicationListResponsePayload
                 If the method is called asynchronously,
                 returns the request thread.
        """
        kwargs['_return_http_data_only'] = True
        if kwargs.get('async_req'):
            return self.project_get_applications_v2_with_http_info(authorization, project_id, **kwargs)  # noqa: E501
        else:
            (data) = self.project_get_applications_v2_with_http_info(authorization, project_id, **kwargs)  # noqa: E501
            return data

    def project_get_applications_v2_with_http_info(self, authorization, project_id, **kwargs):  # noqa: E501
        """Get all applications in a project according to project ID.  # noqa: E501

        Retrieves a list of all applications in a project with ID {projectId}.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.project_get_applications_v2_with_http_info(authorization, project_id, async_req=True)
        >>> result = thread.get()

        :param async_req bool
        :param str authorization: Format: Bearer <token>, with <token> from login API response. (required)
        :param str project_id: ID for the project (required)
        :param int page_index: 0-based index of the page to fetch results.
        :param int page_size: Item count of each page.
        :param list[str] order_by: Specify result order. Zero or more entries with format: &ltkey> [desc] where orderByKeys lists allowed keys in each response.
        :param str filter: Specify result filter. Format is similar to a SQL WHERE clause. For example, to filter object by name with prefix foo, use: name LIKE 'foo%'. Supported filter keys are the same as order by keys.
        :return: ApplicationListResponsePayload
                 If the method is called asynchronously,
                 returns the request thread.
        """

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

        collection_formats = {}

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

        query_params = []
        if 'page_index' in params:
            query_params.append(('pageIndex', params['page_index']))  # noqa: E501
        if 'page_size' in params:
            query_params.append(('pageSize', params['page_size']))  # noqa: E501
        if 'order_by' in params:
            query_params.append(('orderBy', params['order_by']))  # noqa: E501
            collection_formats['orderBy'] = 'csv'  # noqa: E501
        if 'filter' in params:
            query_params.append(('filter', params['filter']))  # noqa: E501

        header_params = {}
        if 'authorization' in params:
            header_params['Authorization'] = 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'])  # noqa: E501

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

        return self.api_client.call_api(
            '/v1.0/projects/{projectId}/applications', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='ApplicationListResponsePayload',  # 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)
