Source code for api.documents.v1.document.document

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


[docs]@register_command(extending=('documents','v1','document','')) def get_meta_info_by_id(documentID: int,json: bool = True, verify: bool = True, apiKey: str = "", authentication: dict = {}) -> dict: """Fetch specified document excluding content (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: {"offset": 582, "limit": 511, "responseCode": 200, "count": 111, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Create know relationship show.", "messageTemplate": "Civil born per candidate big quality threat.", "field": "From summer clearly teacher.", "parameter": {}, "timestamp": 933090053}], "currentPage": 885, "size": 439} """ from requests import get from argus_api.exceptions import http url = "https://portal.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 = {} 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 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": 914, "limit": 974, "responseCode": 200, "count": 831, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Lot later leader increase.", "messageTemplate": "Guy after edge court face interview.", "field": "Have manage may identify line.", "parameter": {}, "timestamp": 845500974}], "currentPage": 89, "size": 977} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 763, "limit": 702, "responseCode": 200, "count": 473, "data": [{"id": 134, "subject": {"id": 172, "customerID": 907, "name": "Rachel Herrera"}, "level": "write"}], "metaData": {"additionalProperties": {}}, "messages": [{"message": "Example side land story war century newspaper address.", "messageTemplate": "Unit surface without meet.", "field": "International condition rest mouth might evidence.", "parameter": {}, "timestamp": 1368491158}], "currentPage": 958, "size": 396} """ from requests import get from argus_api.exceptions import http url = "https://portal.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": 944, "limit": 892, "responseCode": 200, "count": 742, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Act meet capital any main.", "messageTemplate": "Fly system month those crime.", "field": "Develop significant energy watch president see idea work.", "parameter": {}, "timestamp": 642271784}], "currentPage": 985, "size": 833} """ from requests import post from argus_api.exceptions import http url = "https://portal.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": 27, "limit": 789, "responseCode": 200, "count": 434, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Real traditional bad agreement type rock report.", "messageTemplate": "Compare become world whole green culture.", "field": "Will modern save group court.", "parameter": {}, "timestamp": 360351262}], "currentPage": 555, "size": 120} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 319, "limit": 503, "responseCode": 200, "count": 950, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Degree size that.", "messageTemplate": "Thought doctor item there continue.", "field": "Similar both gas develop several outside ground blue.", "parameter": {}, "timestamp": 1180308702}], "currentPage": 818, "size": 931} """ from requests import delete from argus_api.exceptions import http url = "https://portal.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": 838, "responseCode": 200, "count": 250, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Sell image through station.", "messageTemplate": "Him attack approach account performance.", "field": "Police defense expert available peace along management particularly.", "parameter": {}, "timestamp": 407418671}], "currentPage": 101, "size": 517} """ from requests import put from argus_api.exceptions import http url = "https://portal.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://portal.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": 402, "limit": 20, "responseCode": 200, "count": 146, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Both strategy real high sell throw old wide.", "messageTemplate": "Stock country item space how billion build anything.", "field": "Represent professional born.", "parameter": {}, "timestamp": 1443897217}], "currentPage": 67, "size": 98} """ from requests import put from argus_api.exceptions import http url = "https://portal.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": 449, "limit": 247, "responseCode": 200, "count": 554, "metaData": {"additionalProperties": {}}, "messages": [{"message": "Federal growth history car.", "messageTemplate": "Different popular method affect smile thousand.", "field": "Prove statement charge go dinner glass.", "parameter": {}, "timestamp": 547684035}], "currentPage": 231, "size": 588} """ from requests import get from argus_api.exceptions import http url = "https://portal.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