bunactyl
Version:
TypeScript SDK for Pterodactyl
38 lines (37 loc) • 1.02 kB
JavaScript
import { BunactylClient } from '../client';
export class AllocationsResource {
constructor(client) {
this.client = client;
}
/**
* List allocations for a node
*
* @param nodeId Node ID
* @param include Optional resources to include
*/
async list(nodeId, include) {
const params = {};
if (include) {
params['include'] = include;
}
return await this.client.get(`/nodes/${nodeId}/allocations`, { params });
}
/**
* Create allocations for a node
*
* @param nodeId Node ID
* @param allocationData Allocation data
*/
async create(nodeId, allocationData) {
await this.client.post(`/nodes/${nodeId}/allocations`, allocationData);
}
/**
* Delete an allocation
*
* @param nodeId Node ID
* @param allocationId Allocation ID
*/
async delete(nodeId, allocationId) {
await this.client.delete(`/nodes/${nodeId}/allocations/${allocationId}`);
}
}