wiki.js-wrapper
About
wiki.js-wrapper is a work-in-progress wrapper for the Wiki.js API (GraphQL)
written in Typescript.
Installation
wiki.js-wrapper doesn't have any dependencies,
and is available through the node package manager
npm i wiki.js-wrapper
Example usage
Get a token for the API through the admin-panel, and provide the URL for your Wiki.js instance.
const {Client} = require("wiki.js-wrapper");
const client = new Client({
baseURL: "https://example.com/graphql",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhcGkiOjEsImdycCI6MSwiaWF0IjoxNjQ5MjAzMjAwLCJleHAiOjE2ODA3MzkyMDAsImF1ZCI6InVybjp3aWtpLmpzIiwiaXNzIjoidXJuOndpa2kuanMiLCJ0eXBlIjoiZmFrZS1hc3MtdG9rZW4ifQ.FEWmrlsNrmbf9ESIgOhECNB_N9wRofUbM6UYLGpUrlw"
});
client.login()
.then((title)=>{
console.log(`Connected to ${title}.`);
client.pages.get(1)
.then(page => {
console.log(page);
})
.catch(e => {
console.error(e);
});
})
.catch(e => {
console.error(e);
});
Links
Contributing
Should you wish to contribute to the application,
you may fork this repository and create a pull request.
Thank You's
- Ten for creating this package.
- Discord.js for inspiration on package and documentation.
- Ben Jamming for help with typings.