api.currentuser.v1.prefs — Argus-Toolbelt 1.0 documentation

# Source code for api.currentuser.v1.prefs

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

    @register_command(extending=('currentuser','v1','prefs'))
    def list_properties(json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """List all current user's preferences (PUBLIC)
    Returns a dictionary of key/value pairs, defining all the users preferences

        :raises AuthenticationFailedException: on 401
        :returns: {"offset": 791, "limit": 494, "responseCode": 200, "count": 240, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Base sort memory them whose feeling.", "messageTemplate": "Represent back how manager nothing.", "field": "Character commercial suffer star something game.", "parameter": {}, "timestamp": 1036251586}], "currentPage": 788, "size": 805}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/currentuser/v1/prefs".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 = {}

        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=('currentuser','v1','prefs'))
    def set_properties(body: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Set the specified current user's preferences (PUBLIC)

        :param  body: Map of preference values to update
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :returns: {"offset": 755, "limit": 841, "responseCode": 200, "count": 795, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Power establish prepare movie prevent.", "messageTemplate": "Your example believe.", "field": "Daughter run now.", "parameter": {}, "timestamp": 1408470621}], "currentPage": 494, "size": 107}
        """
        from requests import post
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/currentuser/v1/prefs".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 body:
            body.update({"body": body})

        response = post(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=('currentuser','v1','prefs'))
    def delete_properties(key: list = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Delete multiple current user's preferences (PUBLIC)

        :param list key: Keys to delete
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :returns: {"offset": 376, "limit": 742, "responseCode": 200, "count": 354, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Heavy manager question speech yard never.", "messageTemplate": "Hit nothing forward Democrat their war.", "field": "Operation world its community become.", "parameter": {}, "timestamp": 829775524}], "currentPage": 989, "size": 491}
        """
        from requests import delete
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/currentuser/v1/prefs".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 key:
            body.update({"key": key})

        response = delete(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=('currentuser','v1','prefs'))
    def get_property(propertyKey: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Fetch a specific current user' preference value (PUBLIC)
    Returns a the specified preference value, or null if not set

        :param str propertyKey: Preference value to fetch
        :raises AuthenticationFailedException: on 401
        :raises KeyNotSetException: on 404
        :returns: {}
        """
        from requests import get
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/currentuser/v1/prefs/{propertyKey}".format(propertyKey=propertyKey)
        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=('currentuser','v1','prefs'))
    def delete_property(propertyKey: str,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
        """Delete the specified current user's preference (PUBLIC)

        :param str propertyKey: Preference key to delete
        :raises AuthenticationFailedException: on 401
        :raises AccessDeniedException: on 403
        :returns: {"offset": 885, "limit": 769, "responseCode": 200, "count": 251, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Listen fly animal current give main.", "messageTemplate": "Dinner wrong notice stock step consumer.", "field": "Year claim make treatment memory grow reduce man.", "parameter": {}, "timestamp": 882384866}], "currentPage": 811, "size": 213}
        """
        from requests import delete
        from argus_api.exceptions import http

        url = "https://portal.mnemonic.no/web/api/currentuser/v1/prefs/{propertyKey}".format(propertyKey=propertyKey)
        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 = delete(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