import { HetznerServer } from './classes.server.js'; import * as plugins from './hetznercloud.plugins.js'; export class HetznerAccount { public token: string; constructor(tokenArg: string) { this.token = tokenArg; } public async getServers() { return HetznerServer.getServers(this); } /** * request things from the hetzner API * @param methodArg * @param pathArg * @param payloadArg */ public request = async (methodArg: string, pathArg: string, payloadArg: any) => { const url = `https://api.hetzner.cloud/v1${pathArg}`; const response = await plugins.smartrequest.request(url, { method: methodArg, headers: { Authorization: `Bearer ${this.token}`, }, requestBody: payloadArg, }); return response; } }