# Source code for api.currentuser.v1.functions

    """Autogenerated API"""
    import requests
    from argus_cli.plugin import register_command

    @register_command(extending=('currentuser','v1','functions'))
    def get_functions(onlyRoles: bool = None, keywords: list = None, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List the current user's permission functions regardless of customer (PUBLIC)

        :param bool onlyRoles: Only return functions marked as roles
        :param list keywords: Filter functions by keywords on name and description
        :param int offset: Skip a number of functions
        :param int limit: Maximum number of returned functions
        :raises AuthenticationFailedException: on 401
        :raises ForbiddenPermissionException: on 403
        :returns: {"offset": 844, "limit": 706, "responseCode": 200, "count": 988, "data": [{"id": 137, "name": "Kelly Bennett", "description": "Society nature else perhaps add want prepare.", "securityLevel": "DEFAULT", "flags": ["ROLE"]}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Exactly get officer result green.", "messageTemplate": "Then defense training Republican.", "field": "Major radio place.", "parameter": {}, "timestamp": 452244622}], "currentPage": 62, "size": 39}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/currentuser/v1/functions".format()
        headers = {
            'Content-Type': 'application/json',
            'User-Agent': 'ArgusToolbelt/1.0'
        }

        if apiKey:
            headers["Argus-API-Key"] = apiKey
        elif authentication and isinstance(authentication, dict):
            headers.update(authentication)
        elif callable(authentication):
            headers.update(authentication(url))

        body = {}

        if offset:
            body.update({"offset": offset})

        if limit:
            body.update({"limit": limit})

        if onlyRoles:
            body.update({"onlyRoles": onlyRoles})

        if keywords:
            body.update({"keywords": keywords})

        response = get(url, json=body if body else None, verify=verify, headers=headers)

        errors = []
        if response.status_code == 401:
            raise http.AuthenticationFailedException(response)
        elif response.status_code == 403:
            raise http.AccessDeniedException(response)
        elif response.status_code == 412:
            raise http.ValidationErrorException(response)
        elif response.status_code == 404:
            raise http.ObjectNotFoundException(response)

        return response.json() if json else response