# Source code for api.permissions.v1.function.function

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

    @register_command(extending=('permissions','v1','function',''))
    def get_function_by_id(id: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Request information about a function by ID (DEV)
    Request information about a function by ID. If user does not have access to requested function, a 403 access denied will be returned.

        :param int id: Function ID
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 398, "limit": 670, "responseCode": 200, "count": 664, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Show put me possible student off.", "messageTemplate": "At job finally get five.", "field": "It another instead window catch.", "parameter": {}, "timestamp": 688033472}], "currentPage": 529, "size": 983}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/permissions/v1/function/{id}".format(id=id)
        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 = {}

        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

    @register_command(extending=('permissions','v1','function',''))
    def get_function_by_name(name: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Request information about a function by name (DEV)
    Request information about a function by name. If user does not have access to requested function, a 403 access denied will be returned.

        :param str name: Function name
        :raises AuthenticationFailedException: on 401
        :raises ValidationErrorException: on 412
        :raises AccessDeniedException: on 403
        :returns: {"offset": 672, "limit": 323, "responseCode": 200, "count": 107, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Remember throughout local short manager through indeed.", "messageTemplate": "Computer politics order address.", "field": "Teach look inside member true.", "parameter": {}, "timestamp": 329769417}], "currentPage": 781, "size": 866}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/permissions/v1/function/{name}".format(name=name)
        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 = {}

        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