"""Autogenerated API"""
import requests
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 = "", 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": 624, "limit": 827, "responseCode": 200, "count": 241, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Whether discover rich all.", "messageTemplate": "Body though mention far water.", "field": "Why open church available their whatever news.", "parameter": {}, "timestamp": 498531015}], "currentPage": 597, "size": 717}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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
[docs]@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": 158, "limit": 136, "responseCode": 200, "count": 751, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Sense learn law deal.", "messageTemplate": "Inside explain throw impact guy.", "field": "Adult company decide spring dinner.", "parameter": {}, "timestamp": 301109939}], "currentPage": 766, "size": 338}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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
[docs]@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": 103, "limit": 686, "responseCode": 200, "count": 100, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Land carry these ability tonight seek.", "messageTemplate": "Certain describe say practice might statement morning.", "field": "Word time consumer method work relationship.", "parameter": {}, "timestamp": 1102587370}], "currentPage": 897, "size": 982}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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
[docs]@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://osl-argus-trunk-web1.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
[docs]@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": 608, "limit": 737, "responseCode": 200, "count": 420, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Pass forward between work.", "messageTemplate": "Artist program news rate avoid owner.", "field": "Community address each loss full church expert.", "parameter": {}, "timestamp": 1240381678}], "currentPage": 706, "size": 265}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.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