An open API service indexing awesome lists of open source software.

https://github.com/pteropackages/pterojslite

A lightweight alternative to PteroJS
https://github.com/pteropackages/pterojslite

api javascript pterodactyl pterodactyl-api pterojs pterojslite typescript wrapper

Last synced: 11 months ago
JSON representation

A lightweight alternative to PteroJS

Awesome Lists containing this project

README

          

PteroJSLite


A lightweight alternative to PteroJS


## About

PteroJSLite is a lightweight alternative to [PteroJS](https://github.com/PteroPackages/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.

## Installing

You must have NodeJS v14 or above to use this package.

```
npm install @devnote-dev/pterojslite
yarn add @devnote-dev/pterojslite
```

## Compatibility

PteroJSLite supports version 1.7+ of the panel, and version 1.6+ of Wings.

## Getting Started

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.

```js
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
})();
```

```js
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
})();
```

## Contributing

Please [create an issue](https://github.com/PteroPackages/PteroJSLite/issues) for issues or feature requests for the package.

1. [Fork this repo](https://github.com/PteroPackages/PteroJSLite/fork)!
2. Make a branch from `main` (`git branch -b `)
3. Commit your changes (`git commit -am "..."`)
4. Open a PR here (`git push origin `)

## Contributors

- [Devonte](https://github.com/devnote-dev) - Owner, maintainer
- [Tlkh40](https://github.com/tlkh40) - Code contributor

This repository is managed under the MIT license.

© 2021-present PteroPackages