Document

Accounts

document.account.account(auth_id, account_id)
document.account.accounts(auth_id, sort=None)
document.account.acl_agents(auth_id, account_id)

Only returns security agent ids. To get more info, use rpc.identity.agent methods.

document.account.acl_groups(auth_id, account_id)

Only returns security group ids. To get more info, use rpc.identity.group methods.

document.account.acl_members(auth_id, account_id)

Only returns user ids. To get more info, use rpc.identity.member methods.

document.account.acl_owners(account_id)

Only returns user ids. To get more info, or to get the set of non-owners, use rpc.identity.member methods.

document.account.add_acl_agents(auth_id, account_id, agent_ids)
document.account.add_acl_groups(auth_id, account_id, group_ids)
document.account.add_acl_members(auth_id, account_id, user_ids)
document.account.add_acl_owners(auth_id, account_id, user_ids)
document.account.backup(auth_id, account_id, backup_id)
document.account.backups(auth_id, account_id, sort=None)
document.account.create(auth_id, **values)
document.account.create_backup(auth_id, account_id, **values)
document.account.delete(auth_id, account_id)
document.account.delete_backup(auth_id, account_id)
document.account.owned_accounts(auth_id, sort=None)
document.account.remove_acl_agents(auth_id, account_id, agent_ids)
document.account.remove_acl_groups(auth_id, account_id, group_ids)
document.account.remove_acl_members(auth_id, account_id, user_ids)
document.account.remove_acl_owners(auth_id, account_id, user_ids)
document.account.system_accounts(auth_id, agent_id, sort=None)
document.account.update(auth_id, account_id, **values)
document.account.update_backup(auth_id, account_id, **values)

View

document.view.cat(config)

Concatenates two or more files together into a single output file

Parameters
  • config (dict) – Configuration mapping with the following parameters:

  • compression (-) – What compression, if any, to use

  • target_file (-) – account and path keys

  • frames (-) – A list of input files with keys source_file and id

Returns

None

document.view.commit_upload(account_id, path, upload_id)

Commits an upload

Parameters
  • account_id (int) – Unique account identifier

  • path (str) – Path to list under

  • upload_id (str) – The ID of the upload

Returns

None

document.view.convert_enc(config)

Converts encoding of file defined in config

Parameters

config (dict) – Configuration mapping

Returns

None

document.view.copy(account_id, path, to_path, folder=False)

Copies a document view

Parameters
  • account_id (str) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • to_path (str) – Object rollup path using unix style forward slashes

  • folder (bool, optional) – Is this a folder or a file? Default False

Returns

None

document.view.create_folder(account_id, path, name)

Creates a folder in the view hierarchy

Parameters
  • account_id (str) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • name (str) – The object name

Returns

None

document.view.delete(account_id, path, folder=False)

Deletes a file or folder in the document view

Parameters
  • account_id (str) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • folder (bool, optional) – Is this a folder or a file? Default False

Returns

None

document.view.delete_folder(account_id, path)

Deletes a folder and its contents in the view hierarchy

Parameters
  • account_id (str) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

Returns

None

document.view.dir(account_id, path='/')

Returns the contents of a directory.

Parameters
  • account_id (int) – Document account to use

  • path (str, optional) – Which directory to traverse

Returns

List of dicts with following keys:
  • name: complete path to item

  • short_name: item’s name within this directory

  • path: Full path to the item (including the item itself)

  • type: ‘file’ or ‘dir’

  • size: filesize of the item

  • time: last modified time

  • version_id: item version (if applicable)

  • source_version_id: Version of source item (if applicable)

  • metadata: Any relevant metadata

  • hash: Hash of the item (if applicable)

  • item_name: name of the file or subdirectory

Return type

list

document.view.download(account_id, path, uncompress=True)

Downloads files or folders specified. If folder is specified it is zipped.

Parameters
  • account_id (int) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • uncompress (bool) – True to uncompress the file after download

Returns

A base64 encoded string, containing the file data.

document.view.file_exists(account_id, path)

Determines if path exists in the provided document account

Parameters
  • path (str) – The path to check

  • account_id (int) – Unique account identifier

Returns

True if the file at path exists, otherwise False

Return type

bool

document.view.generate_download_uri(account_id, path, expires_in=60, secure=True, save_as=False)

Generates a download URI

Parameters
  • account_id (str) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • expires_in (int) – Valid life of download URI in seconds

  • secure (bool) – Whether the download URI is encrupted, defaults to True

  • save_as (bool) – Prompt for Save As rather than name of file

Returns

Download URI

Return type

str

document.view.get_file_info(account_id, path)

Returns metadata related to the provided file.

Parameters
  • account_id (int) – Unique account identifier

  • path (str) – Path to the file in document

Returns

Metadata about the file with following keys:
  • name: the file’s name

  • path: path to the file in document

  • size: size of the file

  • time: Timestamp of the last time this file was modified

  • source_version_id: Source version id

  • metadata: misc metadata

  • hash: Hash of the file

Return type

dict

document.view.listing(account_id, path='', depth=100)

Provides file and folder listing to the depth specified

Parameters
  • account_id (str) – Unique account identifier

  • path (str) – Path to list under. defaults to ‘’.

  • depth (int or None) – Depth to list to. If None, will list all the way to leaves. Assuming the document storage is a strict tree, this will terminate. If there’s ever a backend with loops, please use a very high integer depth instead.

Returns

None

document.view.move(account_id, path, to_path, folder=False)

Moves a document view in the hierarchy

Parameters
  • account_id (int) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • to_path – Where to move the document or folder

  • folder (bool, optional) – Is this a folder or a file? Default False

Returns

None

document.view.private_accounts(id_filter=None)

Provides list of private

Parameters

id_filter (list) – List or tuple of object unique identifiers to which to limit the results

Returns

None

document.view.search_by_name(account_id, text, depth=100, path='', criteria='contains')

Returns list of files and folders that match the search criteria

Parameters
  • account_id (str) – Unique account identifier

  • text (str) – The search text to locate

  • path (str) – The top path to search under. Default ‘’

  • depth (int) – The depth to search to. See view.listing

  • criteria (str) – The search criteria (contains, exact, startswith, or endswith)

Returns

A dict containing two lists. - files: list of paths to files matching text - dirs: list of paths to directories matching text

Return type

dict

document.view.shared_accounts(id_filter=None)

Provides list of shared accounts

Parameters

id_filter (list) – List or tuple of object unique identifiers to which to limit the results

Returns

None

document.view.substitute(account_id, from_path, to_path, substitutions, uncompress=True, compression=None)

Substitutes text in a file

Parameters
  • account_id (int) – The document account ID to access

  • from_path (str) – The source file to perform substitutions on

  • to_path (str) – Where to save the result file

  • substitutions (dict) – A dict defining what substitutions to perform, in the format {source_text: target_text}

  • uncompress (bool) – Uncompress files before substituting

  • compression (str) – zip, bzip, gzip are available compression options

Returns

None

document.view.update_file(account_id, path, to_name)

Updates a file name in the view hierarchy

Parameters
  • account_id (str) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • to_name (str) – What to rename the file at path to

Returns

None

document.view.update_folder(account_id, path, to_path)

Updates a folder name in the view hierarchy

Parameters
  • account_id (str) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • to_path (str) – What to rename the folder at path to

Returns

None

document.view.upload_chunk(chunk, upload_id=None)

Uploads a file to the path specified

Parameters
  • chunk (str) – A base64 encoded chunk of a file to upload

  • upload_id (str, optional) – The ID of the upload. If none is provided, this will be treated as a new upload

Returns

An upload ID

Return type

str

document.view.write_report(pdf, account_id, path, encoding='utf8', compress=False)

Creates a PDF report

Parameters
  • pdf (str) – Base64 encoded string representation of a PDF

  • encoding (str) – What encoding to use to write the PDF, defaults to utf8

  • account_id (str) – Unique account identifier

  • path (str) – Object rollup path using unix style forward slashes

  • compress (bool) – If True, applies PDF compression process to shrink the file size

Returns

None

Private Temp

document.privatetemp.commit_upload(upload_id, path)

Commits an upload

Parameters
  • upload_id (str) – The ID of the upload

  • path (str) – Path to list under

Returns

None

document.privatetemp.copy(path, to_path)

Copies a file

Parameters
  • path (str) – Object rollup path using unix style forward slashes

  • to_path (str) – The destination path

Returns

None

document.privatetemp.create_folder(path, name)

Creates a folder in the private temp drive hierarchy

Parameters
  • path (str) – Object rollup path using unix style forward slashes

  • name (str) – The object name

Returns

None

document.privatetemp.delete(path)

Deletes a file

Parameters

path (str) – Object rollup path using unix style forward slashes

Returns

None

document.privatetemp.delete_folder(path)

Deletes a folder and its contents in the private temp drive hierarchy

Parameters

path (str) – Object rollup path using unix style forward slashes

Returns

None

document.privatetemp.download(path)

Downloads file or directory. Directories are zipped before download.

Parameters

path (str) – Object rollup path using unix style forward slashes

Returns

The file, base64 encoded.

Return type

str

document.privatetemp.listing(depth)

Provides file directory listing to the depth specified

Parameters

depth (int) – How many subfolders to search through.

Returns

None

document.privatetemp.move(path, to_path)

Moves a file in the hierarchy

Parameters
  • path (str) – Object rollup path using unix style forward slashes

  • to_path (str) – Object rollup path using unix style forward slashes

Returns

None

document.privatetemp.search_by_name(text, depth=100, path='', criteria='contains')

Returns list of files and folders that match the search criteria

Parameters
  • text (str) – The search text to locate

  • depth (int) – The depth to search to. See view.listing

  • criteria (str) – The search criteria (contains, exact, startswith, or endswith)

Returns

None

document.privatetemp.update_folder(path, to_path)

Updates a folder name in the private temp drive hierarchy

Parameters
  • path (str) – Object rollup path using unix style forward slashes

  • to_path (str) – What to rename the path to

Returns

None

document.privatetemp.upload_chunk(chunk, upload_id=None)

Uploads file

Parameters
  • chunk (str) – A base64 encoded chunk of the file to upload

  • upload_id (str, optional) – If this is the continuation of an upload, this should be set to the ID of that upload

Returns

None

Shared Temp

document.sharedtemp.commit_upload(upload_id, path)

Commits an upload

Parameters
  • upload_id (str) – The ID of the upload

  • path (str) – Path to list under

Returns

None

document.sharedtemp.copy(path, to_path)

Copies a file

Parameters
  • path (str) – Object rollup path using unix style forward slashes

  • to_path (str) – The destination path

Returns

None

document.sharedtemp.create_folder(path, name)

Creates a folder in the public temp drive hierarchy

Parameters
  • path (str) – Object rollup path using unix style forward slashes

  • name (str) – The object name

Returns

None

document.sharedtemp.delete(path)

Deletes a file

Parameters

path (str) – Object rollup path using unix style forward slashes

Returns

None

document.sharedtemp.delete_folder(path)

Deletes a folder and its contents in the public temp drive hierarchy

Parameters

path (str) – Object rollup path using unix style forward slashes

Returns

None

document.sharedtemp.download(path)

Downloads file or directory. Directories are zipped before download.

Parameters

path (str) – Object rollup path using unix style forward slashes

Returns

The base64 encoded data of the string.

Return type

str

document.sharedtemp.listing(depth)

Provides file directory listing to the depth specified

Parameters

depth (int) – How many subfolders to search through.

Returns

None

document.sharedtemp.move(path, to_path)

Moves a file in the hierarchy

Parameters
  • path (str) – Object rollup path using unix style forward slashes

  • to_path (str) – Object rollup path using unix style forward slashes

Returns

None

document.sharedtemp.search_by_name(text, depth=100, path='', criteria='contains')

Returns list of files and folders that match the search criteria

Parameters
  • text (str) – The search text to locate

  • depth (int) – The depth to search to. See view.listing

  • criteria (str) – The search criteria (contains, exact, startswith, or endswith)

Returns

None

document.sharedtemp.update_folder(path, to_path)

Updates a folder name in the public temp drive hierarchy

Parameters
  • path (str) – Object rollup path using unix style forward slashes

  • to_path (str) – What to rename the path to

Returns

None

document.sharedtemp.upload_chunk(chunk, upload_id=None)

Uploads file

Parameters
  • chunk (str) – A base64 encoded chunk of the file to upload

  • upload_id (str, optional) – If this is the continuation of an upload, this should be set to the ID of that upload

Returns

None