UNPKG

bunactyl

Version:

TypeScript SDK for Pterodactyl

57 lines (56 loc) 1.4 kB
import { BunactylClient } from '../client'; export class LocationsResource { constructor(client) { this.client = client; } /** * List all locations * * @param include Optional resources to include */ async list(include) { const params = {}; if (include) { params['include'] = include; } return await this.client.get('/locations', { params }); } /** * Get details for a specific location * * @param id Location ID * @param include Optional resources to include */ async getById(id, include) { const params = {}; if (include) { params['include'] = include; } return await this.client.get(`/locations/${id}`, { params }); } /** * Create a new location * * @param locationData Location data */ async create(locationData) { return await this.client.post('/locations', locationData); } /** * Update an existing location * * @param id Location ID * @param locationData Location data */ async update(id, locationData) { return await this.client.patch(`/locations/${id}`, locationData); } /** * Delete a location * * @param id Location ID */ async delete(id) { await this.client.delete(`/locations/${id}`); } }