Source code for api.currentuser.v1.prefs

"""Autogenerated API"""

from argus_cli.plugin import register_command



[docs]@register_command(extending=("currentuser","v1","prefs")) def list_properties( json: bool = True, verify: bool = True, apiKey: str = None, 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': 280, 'limit': 709, 'responseCode': 200, 'count': 986, 'data': {}, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Summer shoulder enough.', 'messageTemplate': 'Want understand then bit certainly.', 'field': 'Arm challenge white break will trip six.', 'parameter': {}, 'timestamp': 131806097}], 'currentPage': 181, 'size': 411} """ 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/' } 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 ) 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
[docs]@register_command(extending=("currentuser","v1","prefs")) def set_properties( body = None, json: bool = True, verify: bool = True, apiKey: str = None, 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': 531, 'limit': 414, 'responseCode': 200, 'count': 878, 'data': {}, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Subject we modern entire town.', 'messageTemplate': 'Wide serious upon sure.', 'field': 'Edge woman see adult maintain place crime.', 'parameter': {}, 'timestamp': 1266634069}], 'currentPage': 909, 'size': 733} """ 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/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "body": body } response = post(url, json=body if body else None, verify=verify, headers=headers ) 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
[docs]@register_command(extending=("currentuser","v1","prefs")) def delete_properties( key: list = None, json: bool = True, verify: bool = True, apiKey: str = None, 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': 553, 'limit': 781, 'responseCode': 200, 'count': 181, 'data': {}, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'History hold forget.', 'messageTemplate': 'Show set drop entire.', 'field': 'Cultural particularly with professional lay.', 'parameter': {}, 'timestamp': 1175625774}], 'currentPage': 321, 'size': 944} """ 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/' } if apiKey: headers["Argus-API-Key"] = apiKey elif authentication and isinstance(authentication, dict): headers.update(authentication) elif callable(authentication): headers.update(authentication(url)) body = { "key": key } response = delete(url, json=body if body else None, verify=verify, headers=headers ) 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
[docs]@register_command(extending=("currentuser","v1","prefs")) def get_property( propertyKey: str, json: bool = True, verify: bool = True, apiKey: str = None, 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/' } 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 ) 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
[docs]@register_command(extending=("currentuser","v1","prefs")) def delete_property( propertyKey: str, json: bool = True, verify: bool = True, apiKey: str = None, 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': 743, 'limit': 242, 'responseCode': 200, 'count': 266, 'data': {}, 'metaData': {'additionalProperties': {}}, 'messages': [{'message': 'Whole get many son fast.', 'messageTemplate': 'Citizen even teacher alone attorney rule sometimes game.', 'field': 'Interview speak member catch.', 'parameter': {}, 'timestamp': 604054465}], 'currentPage': 894, 'size': 433} """ 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/' } 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 ) 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