Note

create(vaultId, content, name)

  • vaultId (string, required)

  • content (string, required) - note text content, ex: stringified JSON

  • name (string, required) - note name

  • options (NoteCreateOptions, optional) - parent id, mime type, etc.

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

example
const { noteId } = await akord.note.create(vaultId, "# Hello World", "Hello World note");

const { noteId } = await akord.note.create(
  vaultId,
  JSON.stringify({ name: "My first JSON note" }),
  "My first JSON note",
  { parentId: parentId, mimeType: "application/json" }
);

uploadRevision(noteId, name, content)

  • noteId (string, required)

  • content (string, required) - note text content, ex: stringified JSON

  • name (string, required) - note name

  • options (NoteOptions, optional) - mime type, etc.

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

example
const { transactionId } = await akord.note.uploadRevision(noteId, "# Hello World bis", "Hello World note bis");

move(noteId, parentId)

  • noteId (string, required)

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

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

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

revoke(noteId)

  • noteId (string, required)

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

example
const { transactionId } = await akord.note.revoke(noteId);

restore(noteId)

  • noteId (string, required)

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

example
const { transactionId } = await akord.note.restore(noteId);

delete(noteId)

  • noteId (string, required)

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

example
const { transactionId } = await akord.note.delete(noteId);

get(noteId, options)

  • noteId (string, required)

  • options (GetOptions, optional)

  • returns Promise<Note> - Promise with the note object

example
const note = await akord.note.get(noteId);

listAll(vaultId, options)

  • vaultId (string, required)

  • options (ListOptions, optional)

  • returns Promise<Array<Note>> - Promise with all notes within given vault

example
const notes = await akord.note.listAll(vaultId);

list(vaultId, options)

  • vaultId (string, required)

  • options (ListOptions, optional)

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

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

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

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

getVersion(noteId, index)

Get note text version by index, return the latest version by default

  • noteId (string, required)

  • index (number, optional) - note version index

  • returns Promise<{ name: string, data: string }> - Promise with note name & data string text

example
// get the latest note version
const { name: fileName, data: noteText } = await akord.note.getVersion(noteId);

// get the first note version
const { name: fileName, data: noteText } = await akord.note.getVersion(noteId, 0);

Last updated