Skip to content

willscott/node-localwiki-client

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 41 commits behind openseattle:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

#node-localwiki-client A simple node.js wrapper for the localwiki api.

##Installation:

npm install node-localwiki-client

##Examples:

Require the module:

var LocalWikiClient = require('node-localwiki-client')

Initialize with at least the localwiki url:

var wiki = new LocalWikiClient({
  url: 'YOUR_LOCALWIKI_URL' // like http://seattlewiki.net or https://sfwiki.org
  
  // user and apikey not required for get requests
  user: process.env.LOCALWIKI_USER,
  apikey: process.env.LOCALWIKI_API_KEY
})

create a page named Waterside Park

wiki.create({
  resource_type: LocalWikiClient.Type.PAGE,
  data: {
    'name': "Waterside Park",
    'content': "A simple test page."
  },
  success: function(resource) {
    console.log("Created new page", resource.identifier)
  }
})

get a resource

wiki.fetch({
  identifier: 'WatersidePark',
  success: function(resource) {
    console.log("page data: ", resource.data.content)
  }
})

update a page

wiki.fetch({
  identifier: 'WatersidePark',
  success: function(resource) {
    resource.data.content += "<br /> Updated at " + new Date()
    resource.update(function() {
      console.log("Success");
    })
  }
})

delete a page

resource.delete(function() {
  console.log("resource deleted.");
});

list multiple resources

wiki.list({
  resource_type: LocalWikiClient.Type.PAGE,
  filters: {
    limit: 5
  },
  success: function(items) {
    console.log("found " + items.length + " matching pages.")
  }
})

About

A simple node.js wrapper for the LocalWiki api

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%