Folder

create(vaultId, name, parentId)

  • vaultId (string, required)

  • name (string, required) - folder name

  • options (NodeCreateOptions, optional) - parent id, etc.

  • returns Promise<{ folderId, transactionId }> - Promise with new folder id & corresponding transaction id

example
const { folderId } = await akord.folder.create(vaultId, "my first folder");

rename(folderId, name)

  • folderId (string, required)

  • name (string, required) - new folder name

  • returns Promise<{ transactionId }> - Promise with corresponding transaction id

example
const { transactionId } = await akord.folder.rename(folderId, "my first folder");

move(folderId, parentId)

Move the given folder along with its content to a different folder (parent):

  • folderId (string, required)

  • parentId (string, required) - new parent folder id

  • returns Promise<{ transactionId }> - Promise with corresponding transaction id

example
// create root folder
const rootFolderId = (await akord.folder.create(vaultId, "root folder")).folderId;
// move the folder to newly created root folder
const { transactionId } = await akord.folder.move(folderId, rootFolderId);

revoke(folderId)

Revoke the given folder along with the sub-tree of stacks and folders:

  • folderId (string, required)

  • returns Promise<{ transactionId }> - Promise with corresponding transaction id

example
const { transactionId } = await akord.folder.revoke(folderId);

restore(folderId)

Restore the given folder along with the sub-tree of stacks and folders:

  • folderId (string, required)

  • returns Promise<{ transactionId }> - Promise with corresponding transaction id

example
const { transactionId } = await akord.folder.restore(folderId);

delete(folderId)

Remove the folder along with the sub-tree of stacks and folders from the vault:

  • folderId (string, required)

  • returns Promise<{ transactionId }> - Promise with corresponding transaction id

example
const { transactionId } = await akord.folder.delete(folderId);

get(folderId, options)

  • folderId (string, required)

  • options (GetOptions, optional)

  • returns Promise<Folder> - Promise with the folder object

example
const folder = await akord.folder.get(folderId);

listAll(vaultId, options)

  • vaultId (string, required)

  • options (ListOptions, optional)

  • returns Promise<Array<Folder>> - Promise with all folders within given vault

example
const folders = await akord.folder.listAll(vaultId);

list(vaultId, options)

  • vaultId (string, required)

  • options (ListOptions, optional)

  • returns Promise<{ items, nextToken }> - Promise with paginated folders within given vault

example
// retrieve first 100 folders for the vault
const { items } = await akord.folder.list(vaultId);

// retrieve first 20 folders for the vault
const { items } = await akord.folder.list(vaultId, { limit: 20 });

// iterate through all folders
let token = null;
let folders = [];
do {
  const { items, nextToken } = await akord.folder.list(vaultId, { nextToken: token });
  folders = folders.concat(items);
  token = nextToken;
} while (token);

Last updated