Bear script API

Hello,

I just wrote a script API for Bear. It’s much nicer to use than writing URLs by hand (when you’re a developer, at least).

Usage examples (after including the “BearAPI” action):

  • Prepending to a note:

    Bear.prependTo("Project Ideas", "list");
    // "plain", "list" or "section"
    // Bear.appendTo also exists
    
  • Creating a note:

    Bear.create(draft.content);
    
  • Fetching a note and manipulating it:

    var n = BearNote.fetch("Project Ideas");
    console.log(n.identifier, n.title, n.content, n.isTrashed, n.creationDate, n.modificationDate);
    n.content = "Hello";
    n.append("World");
    n.trash();
    

Feedback welcome! I hope it’s useful to someone :slight_smile:

6 Likes

This is awesome! Thanks for sharing.

Indeed, this is useful! Thank you.