"""Autogenerated API"""
import requests
from argus_cli.plugin import register_command
[docs]@register_command(extending=('documents','v1','document',''))
def update_document(documentID: int, name: str = None, mimeType: str = None, data: str = None, text: str = None, lockRequestTime: int = 300000,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Update specified document (PUBLIC)
:param int documentID: ID of document to update
:param str name: If set change document name => Sanitize by regex [a-zA-Z0-9ÅåØøÆæ_\-\. ]*
:param str mimeType: If set change document MIME type
:param str data: Base64 encoded document content formatted according to the given MIME type. If set change document content
:param str text: Plain text document content. If set change document content
:param int lockRequestTime: Specify how long the document should be locked (default 300000)
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises Exception: on 423
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 422, "limit": 995, "responseCode": 200, "count": 705, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Here traditional think table experience writer person.", "messageTemplate": "About road trip body.", "field": "Television research husband place.", "parameter": {}, "timestamp": 1394968954}], "currentPage": 400, "size": 405}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}".format(documentID=documentID)
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 lockRequestTime:
body.update({"lockRequestTime": lockRequestTime})
if name:
body.update({"name": name})
if mimeType:
body.update({"mimeType": mimeType})
if data:
body.update({"data": data})
if text:
body.update({"text": text})
response = put(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=('documents','v1','document',''))
def list_document_access(documentID: int, offset: int = 0, limit: int = 25,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Fetch ACL for specified document (PUBLIC)
:param int documentID: Document ID
:param int offset: Skip a number of results
:param int limit: Maximum number of returned results
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 898, "limit": 894, "responseCode": 200, "count": 15, "data": [{"id": 963, "subject": {"id": 341, "customerID": 922, "name": "Alicia Sanders"}, "level": "write"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Charge city treatment among year out.", "messageTemplate": "Friend stay eye about nature ground which.", "field": "Lose artist too parent.", "parameter": {}, "timestamp": 1407115337}], "currentPage": 559, "size": 881}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}/access".format(documentID=documentID)
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 offset:
body.update({"offset": offset})
if limit:
body.update({"limit": limit})
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=('documents','v1','document',''))
def grant_document_access(documentID: int, subjectID: int = None, level: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Grant access to specified document (PUBLIC)
If the access level is folder, the user is allowed to obtain the information about the document (without content). If the access level is read, the user is allowed to obtain the content of the document. If the access level is write, the user is allowed to update the document.
:param int documentID: Document ID
:param int subjectID: Specify user/group to grant access to
:param str level: Specify access level to grant to user/group
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 80, "limit": 222, "responseCode": 200, "count": 583, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Under wall place nearly parent including really.", "messageTemplate": "Contain sign trade red step.", "field": "Surface you the she size.", "parameter": {}, "timestamp": 758210325}], "currentPage": 189, "size": 657}
"""
from requests import post
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}/access".format(documentID=documentID)
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 subjectID:
body.update({"subjectID": subjectID})
if level:
body.update({"level": level})
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=('documents','v1','document',''))
def update_document_access_settings(documentID: int, accessMode: str = None,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Change access settings on specified document (PUBLIC)
If the access mode is roleBased, user accessing the document must have appropriate role, set by administrator. If the access mode is writeRestricted, user accessing the document can read, but must have appropriate role for write, set by administrator. If the access mode is readRestricted, user accessing the document must have appropriate roles for both read and write, set by administrator. If the access mode is explicit, user accessing the document must have explicit grant by document's owner.
:param int documentID: Document ID
:param str accessMode: Specify general access mode for document/folder
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 619, "limit": 989, "responseCode": 200, "count": 861, "metaData": {"additionalProperties": {}}, "messages": [{"message": "West office without market whether help stay.", "messageTemplate": "Production continue staff may that people vote.", "field": "Player provide trip.", "parameter": {}, "timestamp": 235924427}], "currentPage": 941, "size": 523}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}/access".format(documentID=documentID)
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 accessMode:
body.update({"accessMode": accessMode})
response = put(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=('documents','v1','document',''))
def revoke_document_access(documentID: int, accessID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Revoke specified explicit access from document (PUBLIC)
:param int documentID: Document ID
:param int accessID: Access ID
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 449, "limit": 32, "responseCode": 200, "count": 906, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Approach everybody speech wonder.", "messageTemplate": "Remember past marriage born raise strong condition tough.", "field": "Together point memory standard common wish close.", "parameter": {}, "timestamp": 261686376}], "currentPage": 955, "size": 225}
"""
from requests import delete
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}/access/{accessID}".format(documentID=documentID, accessID=accessID)
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
[docs]@register_command(extending=('documents','v1','document',''))
def commit_document(documentID: int, name: str = None, mimeType: str = None, data: str = None, text: str = None, lockRequestTime: int = 300000,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Commit specified document (PUBLIC)
:param int documentID: ID of document to commit
:param str name: If set change document name => Sanitize by regex [a-zA-Z0-9ÅåØøÆæ_\-\. ]*
:param str mimeType: If set change document MIME type
:param str data: Base64 encoded document content formatted according to the given MIME type. If set change document content
:param str text: Plain text document content. If set change document content
:param int lockRequestTime: Specify how long the document should be locked (default 300000)
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises Exception: on 423
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 870, "limit": 593, "responseCode": 200, "count": 557, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Might may federal painting activity.", "messageTemplate": "So ground president message rock final bed.", "field": "In population pattern.", "parameter": {}, "timestamp": 113984355}], "currentPage": 494, "size": 767}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}/commit".format(documentID=documentID)
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 lockRequestTime:
body.update({"lockRequestTime": lockRequestTime})
if name:
body.update({"name": name})
if mimeType:
body.update({"mimeType": mimeType})
if data:
body.update({"data": data})
if text:
body.update({"text": text})
response = put(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=('documents','v1','document',''))
def get_document_content_by_id(documentID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Download content as a file for specified document (PUBLIC)
:param int documentID: ID of document to fetch
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}/content".format(documentID=documentID)
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=('documents','v1','document',''))
def lock_document(documentID: int, lockRequestTime: int = None, mode: str = 'LOCK',json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Lock/Unlock specified document (PUBLIC)
:param int documentID: ID of document to lock/unlock
:param int lockRequestTime: If 'mode' is set to LOCK, specify how long the document should be locked
:param str mode: Specify whether to lock or unlock the document, or to override an existing lock (default LOCK)
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises Exception: on 423
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 380, "limit": 876, "responseCode": 200, "count": 93, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Space focus discover probably out think road.", "messageTemplate": "Point push before fund walk.", "field": "Message effect after whatever news true bit the.", "parameter": {}, "timestamp": 406993767}], "currentPage": 24, "size": 440}
"""
from requests import put
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}/lock".format(documentID=documentID)
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 mode:
body.update({"mode": mode})
if lockRequestTime:
body.update({"lockRequestTime": lockRequestTime})
response = put(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=('documents','v1','document',''))
def get_document_revisions(documentID: int, limit: int = 25, offset: int = 0,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict:
"""Fetch specified document revisions (PUBLIC)
:param int documentID: ID of document to fetch revisions
:param int limit: Maximum number of returned results
:param int offset: Skip a number of results
:raises AuthenticationFailedException: on 401
:raises ValidationFailedException: on 412
:raises AccessDeniedException: on 403
:raises ObjectNotFoundException: on 404
:returns: {"offset": 693, "limit": 645, "responseCode": 200, "count": 215, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Break after I what power.", "messageTemplate": "Listen chair event already turn.", "field": "Sea member experience.", "parameter": {}, "timestamp": 210855037}], "currentPage": 439, "size": 429}
"""
from requests import get
from argus_api.exceptions import http
url = "https://osl-argus-trunk-web1.mnemonic.no/web/api/documents/v1/document/{documentID}/versions".format(documentID=documentID)
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 limit:
body.update({"limit": limit})
if offset:
body.update({"offset": offset})
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