fix(core): update
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import * as plugins from './hetznercloud.plugins.js';
|
||||
|
||||
export class HetznerAccount {
|
||||
public token: string;
|
||||
constructor(tokenArg: string) {
|
||||
this.token = tokenArg;
|
||||
}
|
||||
|
||||
getServers() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user