"""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": 904, "limit": 600, "responseCode": 200, "count": 477, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Within entire member focus stock letter attention sense.", "messageTemplate": "Training too drive owner become control give certain.", "field": "For star example fly.", "parameter": {}, "timestamp": 668684667}], "currentPage": 419, "size": 902}
"""
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": 196, "limit": 627, "responseCode": 200, "count": 543, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Election foot loss while toward PM wear.", "messageTemplate": "Source pattern much response.", "field": "Difference black say suggest power.", "parameter": {}, "timestamp": 257301571}], "currentPage": 71, "size": 783}
"""
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": 972, "limit": 116, "responseCode": 200, "count": 2, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Toward performance get provide level.", "messageTemplate": "Book similar forward reach actually.", "field": "Huge for same order.", "parameter": {}, "timestamp": 598571796}], "currentPage": 965, "size": 556}
"""
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": 53, "limit": 896, "responseCode": 200, "count": 641, "data": {}, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Skill those it.", "messageTemplate": "Draw benefit result hit brother inside.", "field": "Represent no way arm stand.", "parameter": {}, "timestamp": 750495011}], "currentPage": 817, "size": 845}
"""
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