PteroJSLite is a lightweight alternative to PteroJS using only objects and functions - absolutely no classes! This package is ideal if you want a high-level package without the abstractions and helper methods of larger libraries, while still getting same amount of functionality.
You must have NodeJS v14 or above to use this package.
npm install @devnote-dev/pterojslite
yarn add @devnote-dev/pterojslite
PteroJSLite supports version 1.7+ of the panel, and version 1.6+ of Wings.
Application and Client API instances can be created using the createApp
and createClient
functions respectively. Both application keys (ptla
) and client keys (ptlc
) are currently supported.
const { createApp } = require('@devnote-dev/pterojslite');
const app = createApp('https://your.panel.domain', 'ptla_your_api_key');
app.getServers().then(console.log);
(async () => {
const users = await app.getUsers(); // returns an array of user objects
console.log(users.filter(u => u.rootAdmin)); // filters out non-admin users
})();
const { createClient } = require('@devnote-dev/pterojslite');
const client = createClient('https://your.panel.domain', 'ptlc_your_api_key');
client.getAccount().then(console.log);
(async () => {
const activities = await app.getActivities(); // returns an array of activity logs
console.log(activities.filter(a => a.isAPI)); // filters out non-API activities
})();
Please create an issue for issues or feature requests for the package.
- Fork this repo!
- Make a branch from
main
(git branch -b <new-feature>
) - Commit your changes (
git commit -am "..."
) - Open a PR here (
git push origin <new-feature>
)
This repository is managed under the MIT license.
© 2021-present PteroPackages