# coding: utf-8

"""
    FINBOURNE Access Management API

    FINBOURNE Technology  # noqa: E501

    Contact: info@finbourne.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


import re  # noqa: F401
import io
import warnings

from pydantic.v1 import validate_arguments, ValidationError
from typing import overload, Optional, Union, Awaitable

from typing_extensions import Annotated
from pydantic.v1 import Field, StrictStr, conint, constr, validator

from typing import Optional

from finbourne_access.models.add_policy_collection_to_role_request import AddPolicyCollectionToRoleRequest
from finbourne_access.models.add_policy_to_role_request import AddPolicyToRoleRequest
from finbourne_access.models.resource_list_of_user_role_response import ResourceListOfUserRoleResponse
from finbourne_access.models.user_role_creation_request import UserRoleCreationRequest
from finbourne_access.models.user_role_response import UserRoleResponse
from finbourne_access.models.user_role_update_request import UserRoleUpdateRequest

from finbourne_access.api_client import ApiClient
from finbourne_access.api_response import ApiResponse
from finbourne_access.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)
from finbourne_access.extensions.configuration_options import ConfigurationOptions

# ensure templated type usages are imported
from pydantic.v1 import Field, StrictStr
from typing import Optional
from typing_extensions import Annotated

class UserRolesApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

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


    @overload
    async def add_policy_collection_to_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], add_policy_collection_to_role_request : Annotated[AddPolicyCollectionToRoleRequest, Field(..., description="Dto of the policy collection to be added.")], **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @overload
    def add_policy_collection_to_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], add_policy_collection_to_role_request : Annotated[AddPolicyCollectionToRoleRequest, Field(..., description="Dto of the policy collection to be added.")], async_req: Optional[bool]=True, **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @validate_arguments
    def add_policy_collection_to_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], add_policy_collection_to_role_request : Annotated[AddPolicyCollectionToRoleRequest, Field(..., description="Dto of the policy collection to be added.")], async_req: Optional[bool]=None, **kwargs) -> Union[UserRoleResponse, Awaitable[UserRoleResponse]]:  # noqa: E501
        """AddPolicyCollectionToUserRole: Add a policy collection to a user-role  # noqa: E501

        Adds a policy collection to a user-role.  # 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_policy_collection_to_user_role(userid, add_policy_collection_to_role_request, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the User Role to get (required)
        :type userid: str
        :param add_policy_collection_to_role_request: Dto of the policy collection to be added. (required)
        :type add_policy_collection_to_role_request: AddPolicyCollectionToRoleRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: UserRoleResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the add_policy_collection_to_user_role_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.add_policy_collection_to_user_role_with_http_info(userid, add_policy_collection_to_role_request, **kwargs)  # noqa: E501

    @validate_arguments
    def add_policy_collection_to_user_role_with_http_info(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], add_policy_collection_to_role_request : Annotated[AddPolicyCollectionToRoleRequest, Field(..., description="Dto of the policy collection to be added.")], **kwargs) -> ApiResponse:  # noqa: E501
        """AddPolicyCollectionToUserRole: Add a policy collection to a user-role  # noqa: E501

        Adds a policy collection to a user-role.  # 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_policy_collection_to_user_role_with_http_info(userid, add_policy_collection_to_role_request, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the User Role to get (required)
        :type userid: str
        :param add_policy_collection_to_role_request: Dto of the policy collection to be added. (required)
        :type add_policy_collection_to_role_request: AddPolicyCollectionToRoleRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(UserRoleResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'userid',
            'add_policy_collection_to_role_request'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method add_policy_collection_to_user_role" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['userid']:
            _path_params['userid'] = _params['userid']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['add_policy_collection_to_role_request'] is not None:
            _body_params = _params['add_policy_collection_to_role_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
            self.api_client.select_header_content_type(
                ['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "UserRoleResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/userroles/{userid}/policycollections', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))


    @overload
    async def add_policy_to_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], add_policy_to_role_request : Annotated[AddPolicyToRoleRequest, Field(..., description="Dto of the policy to be added.")], **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @overload
    def add_policy_to_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], add_policy_to_role_request : Annotated[AddPolicyToRoleRequest, Field(..., description="Dto of the policy to be added.")], async_req: Optional[bool]=True, **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @validate_arguments
    def add_policy_to_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], add_policy_to_role_request : Annotated[AddPolicyToRoleRequest, Field(..., description="Dto of the policy to be added.")], async_req: Optional[bool]=None, **kwargs) -> Union[UserRoleResponse, Awaitable[UserRoleResponse]]:  # noqa: E501
        """AddPolicyToUserRole: Add a policy to a user-role  # noqa: E501

        Adds a policy to a user-role.  # 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_policy_to_user_role(userid, add_policy_to_role_request, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the User Role to get (required)
        :type userid: str
        :param add_policy_to_role_request: Dto of the policy to be added. (required)
        :type add_policy_to_role_request: AddPolicyToRoleRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: UserRoleResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the add_policy_to_user_role_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.add_policy_to_user_role_with_http_info(userid, add_policy_to_role_request, **kwargs)  # noqa: E501

    @validate_arguments
    def add_policy_to_user_role_with_http_info(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], add_policy_to_role_request : Annotated[AddPolicyToRoleRequest, Field(..., description="Dto of the policy to be added.")], **kwargs) -> ApiResponse:  # noqa: E501
        """AddPolicyToUserRole: Add a policy to a user-role  # noqa: E501

        Adds a policy to a user-role.  # 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_policy_to_user_role_with_http_info(userid, add_policy_to_role_request, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the User Role to get (required)
        :type userid: str
        :param add_policy_to_role_request: Dto of the policy to be added. (required)
        :type add_policy_to_role_request: AddPolicyToRoleRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(UserRoleResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'userid',
            'add_policy_to_role_request'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method add_policy_to_user_role" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['userid']:
            _path_params['userid'] = _params['userid']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['add_policy_to_role_request'] is not None:
            _body_params = _params['add_policy_to_role_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
            self.api_client.select_header_content_type(
                ['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "UserRoleResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/userroles/{userid}/policies', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))


    @overload
    async def create_user_role(self, user_role_creation_request : Annotated[UserRoleCreationRequest, Field(..., description="Definition of the user-role to create.")], **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @overload
    def create_user_role(self, user_role_creation_request : Annotated[UserRoleCreationRequest, Field(..., description="Definition of the user-role to create.")], async_req: Optional[bool]=True, **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @validate_arguments
    def create_user_role(self, user_role_creation_request : Annotated[UserRoleCreationRequest, Field(..., description="Definition of the user-role to create.")], async_req: Optional[bool]=None, **kwargs) -> Union[UserRoleResponse, Awaitable[UserRoleResponse]]:  # noqa: E501
        """CreateUserRole: Create a user-role  # noqa: E501

        Creates a new user-role.  # 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_user_role(user_role_creation_request, async_req=True)
        >>> result = thread.get()

        :param user_role_creation_request: Definition of the user-role to create. (required)
        :type user_role_creation_request: UserRoleCreationRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: UserRoleResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the create_user_role_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.create_user_role_with_http_info(user_role_creation_request, **kwargs)  # noqa: E501

    @validate_arguments
    def create_user_role_with_http_info(self, user_role_creation_request : Annotated[UserRoleCreationRequest, Field(..., description="Definition of the user-role to create.")], **kwargs) -> ApiResponse:  # noqa: E501
        """CreateUserRole: Create a user-role  # noqa: E501

        Creates a new user-role.  # 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_user_role_with_http_info(user_role_creation_request, async_req=True)
        >>> result = thread.get()

        :param user_role_creation_request: Definition of the user-role to create. (required)
        :type user_role_creation_request: UserRoleCreationRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(UserRoleResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'user_role_creation_request'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method create_user_role" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['user_role_creation_request'] is not None:
            _body_params = _params['user_role_creation_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
            self.api_client.select_header_content_type(
                ['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "UserRoleResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/userroles', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))


    @overload
    async def delete_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to delete.")], **kwargs) -> None:  # noqa: E501
        ...

    @overload
    def delete_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to delete.")], async_req: Optional[bool]=True, **kwargs) -> None:  # noqa: E501
        ...

    @validate_arguments
    def delete_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to delete.")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]:  # noqa: E501
        """DeleteUserRole: Delete a user-role  # noqa: E501

        Deletes an identified user-role.  # 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_user_role(userid, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the user-role to delete. (required)
        :type userid: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the delete_user_role_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.delete_user_role_with_http_info(userid, **kwargs)  # noqa: E501

    @validate_arguments
    def delete_user_role_with_http_info(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to delete.")], **kwargs) -> ApiResponse:  # noqa: E501
        """DeleteUserRole: Delete a user-role  # noqa: E501

        Deletes an identified user-role.  # 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_user_role_with_http_info(userid, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the user-role to delete. (required)
        :type userid: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """

        _params = locals()

        _all_params = [
            'userid'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method delete_user_role" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['userid']:
            _path_params['userid'] = _params['userid']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {}

        return self.api_client.call_api(
            '/api/userroles/{userid}', 'DELETE',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))


    @overload
    async def get_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to get.")], **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @overload
    def get_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to get.")], async_req: Optional[bool]=True, **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @validate_arguments
    def get_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to get.")], async_req: Optional[bool]=None, **kwargs) -> Union[UserRoleResponse, Awaitable[UserRoleResponse]]:  # noqa: E501
        """GetUserRole: Get a user-role  # noqa: E501

        Get an identified user-role.  # 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_role(userid, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the user-role to get. (required)
        :type userid: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: UserRoleResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_user_role_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.get_user_role_with_http_info(userid, **kwargs)  # noqa: E501

    @validate_arguments
    def get_user_role_with_http_info(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to get.")], **kwargs) -> ApiResponse:  # noqa: E501
        """GetUserRole: Get a user-role  # noqa: E501

        Get an identified user-role.  # 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_role_with_http_info(userid, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the user-role to get. (required)
        :type userid: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(UserRoleResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'userid'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_user_role" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['userid']:
            _path_params['userid'] = _params['userid']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "UserRoleResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/userroles/{userid}', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))


    @overload
    async def list_user_roles(self, filter : Annotated[Optional[StrictStr], Field( description="Optional. Expression to filter the result set")] = None, sort_by : Annotated[Optional[StrictStr], Field( description="Optional. Order the results by these fields. Use the '-' sign to denote descending order e.g. -MyFieldName")] = None, limit : Annotated[Optional[conint(strict=True)], Field(description="Optional. When paginating, limit the number of returned results to this many.")] = None, page : Annotated[Optional[StrictStr], Field( description="Optional. Encoded page string returned from a previous search result that will retrieve              the next page of data.")] = None, **kwargs) -> ResourceListOfUserRoleResponse:  # noqa: E501
        ...

    @overload
    def list_user_roles(self, filter : Annotated[Optional[StrictStr], Field( description="Optional. Expression to filter the result set")] = None, sort_by : Annotated[Optional[StrictStr], Field( description="Optional. Order the results by these fields. Use the '-' sign to denote descending order e.g. -MyFieldName")] = None, limit : Annotated[Optional[conint(strict=True)], Field(description="Optional. When paginating, limit the number of returned results to this many.")] = None, page : Annotated[Optional[StrictStr], Field( description="Optional. Encoded page string returned from a previous search result that will retrieve              the next page of data.")] = None, async_req: Optional[bool]=True, **kwargs) -> ResourceListOfUserRoleResponse:  # noqa: E501
        ...

    @validate_arguments
    def list_user_roles(self, filter : Annotated[Optional[StrictStr], Field( description="Optional. Expression to filter the result set")] = None, sort_by : Annotated[Optional[StrictStr], Field( description="Optional. Order the results by these fields. Use the '-' sign to denote descending order e.g. -MyFieldName")] = None, limit : Annotated[Optional[conint(strict=True)], Field(description="Optional. When paginating, limit the number of returned results to this many.")] = None, page : Annotated[Optional[StrictStr], Field( description="Optional. Encoded page string returned from a previous search result that will retrieve              the next page of data.")] = None, async_req: Optional[bool]=None, **kwargs) -> Union[ResourceListOfUserRoleResponse, Awaitable[ResourceListOfUserRoleResponse]]:  # noqa: E501
        """ListUserRoles: List user-roles  # noqa: E501

        Lists all user-roles and pages.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_user_roles(filter, sort_by, limit, page, async_req=True)
        >>> result = thread.get()

        :param filter: Optional. Expression to filter the result set
        :type filter: str
        :param sort_by: Optional. Order the results by these fields. Use the '-' sign to denote descending order e.g. -MyFieldName
        :type sort_by: str
        :param limit: Optional. When paginating, limit the number of returned results to this many.
        :type limit: int
        :param page: Optional. Encoded page string returned from a previous search result that will retrieve              the next page of data.
        :type page: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: ResourceListOfUserRoleResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the list_user_roles_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.list_user_roles_with_http_info(filter, sort_by, limit, page, **kwargs)  # noqa: E501

    @validate_arguments
    def list_user_roles_with_http_info(self, filter : Annotated[Optional[StrictStr], Field( description="Optional. Expression to filter the result set")] = None, sort_by : Annotated[Optional[StrictStr], Field( description="Optional. Order the results by these fields. Use the '-' sign to denote descending order e.g. -MyFieldName")] = None, limit : Annotated[Optional[conint(strict=True)], Field(description="Optional. When paginating, limit the number of returned results to this many.")] = None, page : Annotated[Optional[StrictStr], Field( description="Optional. Encoded page string returned from a previous search result that will retrieve              the next page of data.")] = None, **kwargs) -> ApiResponse:  # noqa: E501
        """ListUserRoles: List user-roles  # noqa: E501

        Lists all user-roles and pages.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.list_user_roles_with_http_info(filter, sort_by, limit, page, async_req=True)
        >>> result = thread.get()

        :param filter: Optional. Expression to filter the result set
        :type filter: str
        :param sort_by: Optional. Order the results by these fields. Use the '-' sign to denote descending order e.g. -MyFieldName
        :type sort_by: str
        :param limit: Optional. When paginating, limit the number of returned results to this many.
        :type limit: int
        :param page: Optional. Encoded page string returned from a previous search result that will retrieve              the next page of data.
        :type page: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(ResourceListOfUserRoleResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'filter',
            'sort_by',
            'limit',
            'page'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method list_user_roles" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}

        # process the query parameters
        _query_params = []
        if _params.get('filter') is not None:  # noqa: E501
            _query_params.append(('filter', _params['filter']))

        if _params.get('sort_by') is not None:  # noqa: E501
            _query_params.append(('sortBy', _params['sort_by']))

        if _params.get('limit') is not None:  # noqa: E501
            _query_params.append(('limit', _params['limit']))

        if _params.get('page') is not None:  # noqa: E501
            _query_params.append(('page', _params['page']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "ResourceListOfUserRoleResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/userroles', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))


    @overload
    async def remove_policy_collection_from_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], policy_collection_scope : Annotated[StrictStr, Field(..., description="The scope of policy collection to remove from the User Role")], policy_collection_code : Annotated[StrictStr, Field(..., description="The code of the policy collection to remove from the User Role")], **kwargs) -> None:  # noqa: E501
        ...

    @overload
    def remove_policy_collection_from_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], policy_collection_scope : Annotated[StrictStr, Field(..., description="The scope of policy collection to remove from the User Role")], policy_collection_code : Annotated[StrictStr, Field(..., description="The code of the policy collection to remove from the User Role")], async_req: Optional[bool]=True, **kwargs) -> None:  # noqa: E501
        ...

    @validate_arguments
    def remove_policy_collection_from_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], policy_collection_scope : Annotated[StrictStr, Field(..., description="The scope of policy collection to remove from the User Role")], policy_collection_code : Annotated[StrictStr, Field(..., description="The code of the policy collection to remove from the User Role")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]:  # noqa: E501
        """RemovePolicyCollectionFromUserRole: Remove a policy collection from a user-role  # noqa: E501

        Removes a policy collection from a user-role.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.remove_policy_collection_from_user_role(userid, policy_collection_scope, policy_collection_code, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the User Role to get (required)
        :type userid: str
        :param policy_collection_scope: The scope of policy collection to remove from the User Role (required)
        :type policy_collection_scope: str
        :param policy_collection_code: The code of the policy collection to remove from the User Role (required)
        :type policy_collection_code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the remove_policy_collection_from_user_role_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.remove_policy_collection_from_user_role_with_http_info(userid, policy_collection_scope, policy_collection_code, **kwargs)  # noqa: E501

    @validate_arguments
    def remove_policy_collection_from_user_role_with_http_info(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], policy_collection_scope : Annotated[StrictStr, Field(..., description="The scope of policy collection to remove from the User Role")], policy_collection_code : Annotated[StrictStr, Field(..., description="The code of the policy collection to remove from the User Role")], **kwargs) -> ApiResponse:  # noqa: E501
        """RemovePolicyCollectionFromUserRole: Remove a policy collection from a user-role  # noqa: E501

        Removes a policy collection from a user-role.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.remove_policy_collection_from_user_role_with_http_info(userid, policy_collection_scope, policy_collection_code, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the User Role to get (required)
        :type userid: str
        :param policy_collection_scope: The scope of policy collection to remove from the User Role (required)
        :type policy_collection_scope: str
        :param policy_collection_code: The code of the policy collection to remove from the User Role (required)
        :type policy_collection_code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """

        _params = locals()

        _all_params = [
            'userid',
            'policy_collection_scope',
            'policy_collection_code'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method remove_policy_collection_from_user_role" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['userid']:
            _path_params['userid'] = _params['userid']

        if _params['policy_collection_scope']:
            _path_params['policyCollectionScope'] = _params['policy_collection_scope']

        if _params['policy_collection_code']:
            _path_params['policyCollectionCode'] = _params['policy_collection_code']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {}

        return self.api_client.call_api(
            '/api/userroles/{userid}/policycollections/{policyCollectionScope}/{policyCollectionCode}', 'DELETE',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))


    @overload
    async def remove_policy_from_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], policy_scope : Annotated[StrictStr, Field(..., description="The scope of the policy to remove from the User Role")], policy_code : Annotated[StrictStr, Field(..., description="The code of the policy to remove from the User Role")], **kwargs) -> None:  # noqa: E501
        ...

    @overload
    def remove_policy_from_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], policy_scope : Annotated[StrictStr, Field(..., description="The scope of the policy to remove from the User Role")], policy_code : Annotated[StrictStr, Field(..., description="The code of the policy to remove from the User Role")], async_req: Optional[bool]=True, **kwargs) -> None:  # noqa: E501
        ...

    @validate_arguments
    def remove_policy_from_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], policy_scope : Annotated[StrictStr, Field(..., description="The scope of the policy to remove from the User Role")], policy_code : Annotated[StrictStr, Field(..., description="The code of the policy to remove from the User Role")], async_req: Optional[bool]=None, **kwargs) -> Union[None, Awaitable[None]]:  # noqa: E501
        """RemovePolicyFromUserRole: Remove a policy from a user-role  # noqa: E501

        Removes a policy from a user-role.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.remove_policy_from_user_role(userid, policy_scope, policy_code, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the User Role to get (required)
        :type userid: str
        :param policy_scope: The scope of the policy to remove from the User Role (required)
        :type policy_scope: str
        :param policy_code: The code of the policy to remove from the User Role (required)
        :type policy_code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the remove_policy_from_user_role_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.remove_policy_from_user_role_with_http_info(userid, policy_scope, policy_code, **kwargs)  # noqa: E501

    @validate_arguments
    def remove_policy_from_user_role_with_http_info(self, userid : Annotated[StrictStr, Field(..., description="Id of the User Role to get")], policy_scope : Annotated[StrictStr, Field(..., description="The scope of the policy to remove from the User Role")], policy_code : Annotated[StrictStr, Field(..., description="The code of the policy to remove from the User Role")], **kwargs) -> ApiResponse:  # noqa: E501
        """RemovePolicyFromUserRole: Remove a policy from a user-role  # noqa: E501

        Removes a policy from a user-role.  # noqa: E501
        This method makes a synchronous HTTP request by default. To make an
        asynchronous HTTP request, please pass async_req=True

        >>> thread = api.remove_policy_from_user_role_with_http_info(userid, policy_scope, policy_code, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the User Role to get (required)
        :type userid: str
        :param policy_scope: The scope of the policy to remove from the User Role (required)
        :type policy_scope: str
        :param policy_code: The code of the policy to remove from the User Role (required)
        :type policy_code: str
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: None
        """

        _params = locals()

        _all_params = [
            'userid',
            'policy_scope',
            'policy_code'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method remove_policy_from_user_role" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['userid']:
            _path_params['userid'] = _params['userid']

        if _params['policy_scope']:
            _path_params['policyScope'] = _params['policy_scope']

        if _params['policy_code']:
            _path_params['policyCode'] = _params['policy_code']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {}

        return self.api_client.call_api(
            '/api/userroles/{userid}/policies/{policyScope}/{policyCode}', 'DELETE',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))


    @overload
    async def update_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to be updated.")], user_role_update_request : Annotated[UserRoleUpdateRequest, Field(..., description="Definition of the update to apply to the user-role.")], **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @overload
    def update_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to be updated.")], user_role_update_request : Annotated[UserRoleUpdateRequest, Field(..., description="Definition of the update to apply to the user-role.")], async_req: Optional[bool]=True, **kwargs) -> UserRoleResponse:  # noqa: E501
        ...

    @validate_arguments
    def update_user_role(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to be updated.")], user_role_update_request : Annotated[UserRoleUpdateRequest, Field(..., description="Definition of the update to apply to the user-role.")], async_req: Optional[bool]=None, **kwargs) -> Union[UserRoleResponse, Awaitable[UserRoleResponse]]:  # noqa: E501
        """UpdateUserRole: Update a user-role  # noqa: E501

        Updates an identified user-role.  # 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_user_role(userid, user_role_update_request, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the user-role to be updated. (required)
        :type userid: str
        :param user_role_update_request: Definition of the update to apply to the user-role. (required)
        :type user_role_update_request: UserRoleUpdateRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: UserRoleResponse
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the update_user_role_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)
        if async_req is not None:
            kwargs['async_req'] = async_req
        return self.update_user_role_with_http_info(userid, user_role_update_request, **kwargs)  # noqa: E501

    @validate_arguments
    def update_user_role_with_http_info(self, userid : Annotated[StrictStr, Field(..., description="Id of the user-role to be updated.")], user_role_update_request : Annotated[UserRoleUpdateRequest, Field(..., description="Definition of the update to apply to the user-role.")], **kwargs) -> ApiResponse:  # noqa: E501
        """UpdateUserRole: Update a user-role  # noqa: E501

        Updates an identified user-role.  # 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_user_role_with_http_info(userid, user_role_update_request, async_req=True)
        >>> result = thread.get()

        :param userid: Id of the user-role to be updated. (required)
        :type userid: str
        :param user_role_update_request: Definition of the update to apply to the user-role. (required)
        :type user_role_update_request: UserRoleUpdateRequest
        :param async_req: Whether to execute the request asynchronously.
        :type async_req: bool, optional
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :param _request_timeout: Timeout setting. Do not use - use the opts parameter instead
        :param opts: Configuration options for this request
        :type opts: ConfigurationOptions, optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the authentication
                              in the spec for a single request.
        :type _request_auth: dict, optional
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(UserRoleResponse, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'userid',
            'user_role_update_request'
        ]
        _all_params.extend(
            [
                'async_req',
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers',
                'opts'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method update_user_role" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats = {}

        # process the path parameters
        _path_params = {}
        if _params['userid']:
            _path_params['userid'] = _params['userid']


        # process the query parameters
        _query_params = []
        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params = []
        _files = {}
        # process the body parameter
        _body_params = None
        if _params['user_role_update_request'] is not None:
            _body_params = _params['user_role_update_request']

        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['text/plain', 'application/json', 'text/json'])  # noqa: E501

        # set the HTTP header `Content-Type`
        _content_types_list = _params.get('_content_type',
            self.api_client.select_header_content_type(
                ['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']))
        if _content_types_list:
                _header_params['Content-Type'] = _content_types_list

        # authentication setting
        _auth_settings = ['oauth2']  # noqa: E501

        _response_types_map = {
            '200': "UserRoleResponse",
            '400': "LusidValidationProblemDetails",
        }

        return self.api_client.call_api(
            '/api/userroles/{userid}/update', 'POST',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            async_req=_params.get('async_req'),
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            opts=_params.get('opts'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))
