bunactyl
Version:
TypeScript SDK for Pterodactyl
65 lines (64 loc) • 1.5 kB
JavaScript
import { BunactylClient } from '../client';
export class NodesResource {
constructor(client) {
this.client = client;
}
/**
* List all nodes
*
* @param include Optional resources to include
*/
async list(include) {
const params = {};
if (include) {
params['include'] = include;
}
return await this.client.get('/nodes', { params });
}
/**
* Get details for a specific node
*
* @param id Node ID
* @param include Optional resources to include
*/
async getById(id, include) {
const params = {};
if (include) {
params['include'] = include;
}
return await this.client.get(`/nodes/${id}`, { params });
}
/**
* Get node configuration
*
* @param id Node ID
*/
async getConfiguration(id) {
return await this.client.get(`/nodes/${id}/configuration`);
}
/**
* Create a new node
*
* @param nodeData Node data
*/
async create(nodeData) {
return await this.client.post('/nodes', nodeData);
}
/**
* Update an existing node
*
* @param id Node ID
* @param nodeData Node data
*/
async update(id, nodeData) {
return await this.client.patch(`/nodes/${id}`, nodeData);
}
/**
* Delete a node
*
* @param id Node ID
*/
async delete(id) {
await this.client.delete(`/nodes/${id}`);
}
}