# coding: utf-8

"""
    Habitat repository and authorization API

    Habitat API  # noqa: E501

    OpenAPI spec version: V1.1.1
    Contact: zives@seas.upenn.edu
    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 pennprov.api_client import ApiClient


class PermissionApi(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 add_permission(self, permname, **kwargs):  # noqa: E501
        """Adds a new labeled permission type  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.add_permission(permname, async_req=True)
        >>> result = thread.get()

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

    def add_permission_with_http_info(self, permname, **kwargs):  # noqa: E501
        """Adds a new labeled permission type  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.add_permission_with_http_info(permname, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/types/{permname}', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='int',  # 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_group_permissions_on(self, object, group_name, **kwargs):  # noqa: E501
        """Gets the group's permissions on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_group_permissions_on(object, group_name, async_req=True)
        >>> result = thread.get()

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

    def get_group_permissions_on_with_http_info(self, object, group_name, **kwargs):  # noqa: E501
        """Gets the group's permissions on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_group_permissions_on_with_http_info(object, group_name, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'object' in params:
            path_params['object'] = params['object']  # noqa: E501
        if 'group_name' in params:
            path_params['groupName'] = params['group_name']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/objects/{object}/group/{groupName}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[object]',  # noqa: E501
            auth_settings=auth_settings,
            async_req=params.get('async_req'),
            _return_http_data_only=params.get('_return_http_data_only'),
            _preload_content=params.get('_preload_content', True),
            _request_timeout=params.get('_request_timeout'),
            collection_formats=collection_formats)

    def get_object_ids(self, permname, username, **kwargs):  # noqa: E501
        """Gets the object ids for which the user has the given permission  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_object_ids(permname, username, async_req=True)
        >>> result = thread.get()

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

    def get_object_ids_with_http_info(self, permname, username, **kwargs):  # noqa: E501
        """Gets the object ids for which the user has the given permission  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_object_ids_with_http_info(permname, username, async_req=True)
        >>> result = thread.get()

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

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/name/{permname}/user/{username}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[object]',  # 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_permission_from_id(self, id, **kwargs):  # noqa: E501
        """Gets a permission's name from its integer ID  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_permission_from_id(id, async_req=True)
        >>> result = thread.get()

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

    def get_permission_from_id_with_http_info(self, id, **kwargs):  # noqa: E501
        """Gets a permission's name from its integer ID  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_permission_from_id_with_http_info(id, async_req=True)
        >>> result = thread.get()

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

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

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

    def get_permission_id(self, name, **kwargs):  # noqa: E501
        """Gets a permission's ID from its name  # 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_permission_id(name, async_req=True)
        >>> result = thread.get()

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

    def get_permission_id_with_http_info(self, name, **kwargs):  # noqa: E501
        """Gets a permission's ID from its name  # 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_permission_id_with_http_info(name, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/name/{name}/id', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='int',  # 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_user_permissions_on(self, object, username, **kwargs):  # noqa: E501
        """Gets the user's permissions on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_user_permissions_on(object, username, async_req=True)
        >>> result = thread.get()

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

    def get_user_permissions_on_with_http_info(self, object, username, **kwargs):  # noqa: E501
        """Gets the user's permissions on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.get_user_permissions_on_with_http_info(object, username, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

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

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/objects/{object}/user/{username}', 'GET',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='list[object]',  # 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 grant_group_permission_on(self, object, group_name, permname, **kwargs):  # noqa: E501
        """Grants a group a permission on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.grant_group_permission_on(object, group_name, permname, async_req=True)
        >>> result = thread.get()

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

    def grant_group_permission_on_with_http_info(self, object, group_name, permname, **kwargs):  # noqa: E501
        """Grants a group a permission on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.grant_group_permission_on_with_http_info(object, group_name, permname, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'object' in params:
            path_params['object'] = params['object']  # noqa: E501
        if 'group_name' in params:
            path_params['groupName'] = params['group_name']  # noqa: E501
        if 'permname' in params:
            path_params['permname'] = params['permname']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/objects/{object}/group/{groupName}/{permname}', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='bool',  # 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 grant_user_permission_on(self, object, username, permname, **kwargs):  # noqa: E501
        """Grants a user a permission on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.grant_user_permission_on(object, username, permname, async_req=True)
        >>> result = thread.get()

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

    def grant_user_permission_on_with_http_info(self, object, username, permname, **kwargs):  # noqa: E501
        """Grants a user a permission on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.grant_user_permission_on_with_http_info(object, username, permname, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'object' in params:
            path_params['object'] = params['object']  # noqa: E501
        if 'username' in params:
            path_params['username'] = params['username']  # noqa: E501
        if 'permname' in params:
            path_params['permname'] = params['permname']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/objects/{object}/user/{username}/{permname}', 'POST',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='bool',  # 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 revoke_group_permission_on(self, object, group_name, permname, **kwargs):  # noqa: E501
        """Revokes a group a permission on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.revoke_group_permission_on(object, group_name, permname, async_req=True)
        >>> result = thread.get()

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

    def revoke_group_permission_on_with_http_info(self, object, group_name, permname, **kwargs):  # noqa: E501
        """Revokes a group a permission on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.revoke_group_permission_on_with_http_info(object, group_name, permname, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'object' in params:
            path_params['object'] = params['object']  # noqa: E501
        if 'group_name' in params:
            path_params['groupName'] = params['group_name']  # noqa: E501
        if 'permname' in params:
            path_params['permname'] = params['permname']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/objects/{object}/group/{groupName}/{permname}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='bool',  # 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 revoke_user_permission_on(self, object, username, permname, **kwargs):  # noqa: E501
        """Revokes a user a permission on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.revoke_user_permission_on(object, username, permname, async_req=True)
        >>> result = thread.get()

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

    def revoke_user_permission_on_with_http_info(self, object, username, permname, **kwargs):  # noqa: E501
        """Revokes a user a permission on an object  # noqa: E501

        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True
        >>> thread = api.revoke_user_permission_on_with_http_info(object, username, permname, async_req=True)
        >>> result = thread.get()

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

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

        collection_formats = {}

        path_params = {}
        if 'object' in params:
            path_params['object'] = params['object']  # noqa: E501
        if 'username' in params:
            path_params['username'] = params['username']  # noqa: E501
        if 'permname' in params:
            path_params['permname'] = params['permname']  # noqa: E501

        query_params = []

        header_params = {}

        form_params = []
        local_var_files = {}

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

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

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

        return self.api_client.call_api(
            '/perms/objects/{object}/user/{username}/{permname}', 'DELETE',
            path_params,
            query_params,
            header_params,
            body=body_params,
            post_params=form_params,
            files=local_var_files,
            response_type='bool',  # 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)
