wolkjsclient

A simple JavaScript client to connect with the Wolk notebook instance.

Usage no npm install needed!

<script type="module">
  import wolkjsclient from 'https://cdn.skypack.dev/wolkjsclient';
</script>

README

Wolk JavaScript client

A client, written in JavaScript, to connect to an online Wolk instance and execute the API calls. Wolk (Dutch for "cloud") is an online notebook with a very simple RESTful API.

Installation

npm install wolkjsclient

Examples

Connecting to the client

var wolk = new wolkClass("https://wolkjs.com/", "username", "password");

Checking the user credentials

wolk.checkUser("username", function(data){
  console.log(data);
}, function(err){
  console.log(err);
});

Requesting a note

The first parameter is the note ID.

wolk.getNote(30, function(data){
  console.log(data);
}, function(err){
  console.log(err);
});

Querying all notes

The third parameter is whether to include the note content, the fourth parameter the search term, the fifth parameter the cap (how many notes to load), the sixth parameter the page (if a cap is set) and the seventh parameter which notes to retrieve. These 5 parameters are optional.

wolk.getNotes(function(data){
  console.log(data);
}, function(err){
  console.log(err);
}, false, null, 3, 2, wolk.noteRetrieveType.RetrieveAll);

wolk.noteRetrieveType values

  • wolk.noteRetrieveType.RetrieveAll: get all notes
  • wolk.noteRetrieveType.RetrieveArchived: get only archived notes
  • wolk.noteRetrieveType.RetrieveNonArchived: get only non archived notes

Adding a note

The first parameter is the title and the second parameter is the note content.

wolk.addNote("#duco #test 123", "# This is a test", function(data){
  console.log(data);
}, function(err){
  console.log(err)
});

Updating a note

The first parameter is the note ID, the second parameter is the title and the third parameter is the note content.

wolk.updateNote(30, "#duco #test 1231123", "# This is still a test", function(data){
  console.log(data);
}, function(err){
  console.log(err)
});

Deleting a note

The first parameter is the note ID.

wolk.deleteNote(30, function(data){
  console.log(data);
}, function(err){
  console.log(err)
});

Archiving a note

The first parameter is the note ID.

wolk.archiveNote(3, function(data){
  console.log(data);
}, function(err){
  console.log(err)
});

Requesting the tags

wolk.getTags(function(data){
  console.log(data);
}, function(err){
  console.log(err)
});

Downloading a file

The first parameter is the unique code of the file and the second parameter the location where the file should be saved.

wolk.getFile("d9b791fa-39dc-4b5e-96cb-08f54028402a", "/home/user/image.png", function(data){
  console.log(data);
}, function(err){
  console.log(err);
});

Requesting files of a specific note

This method returns all file meta data (so no file contents) of all files from a specific note.

wolk.getFiles(3, function(data){
  console.log(data);
}, function(err){
  console.log(err);
});

Requesting all files

This method returns all file meta data (so no file contents).

wolk.getAllFiles(function(data){
  console.log(data);
}, function(err){
  console.log(err);
});

Adding a file

The first parameter is the note ID and the second parameter is the path to the file you want to upload.

wolk.addFile(3, "/home/user/Pictures/Screenshot from 2015-11-04 23:55:28.png", function(data){
  console.log(data);
}, function(err){
  console.log(err);
});

Deleting a file

The first parameter is the file ID.

wolk.deleteFile(9, function(data){
  console.log(data);
}, function(err){
  console.log(err);
});

Requesting metadata

This method returns all metadata of the application.

wolk.getMetadata(function(data){
  console.log(data);
}, function(err){
  console.log(err);
});