fix(core): update
This commit is contained in:
27
ts/do.classes.doaccount.ts
Normal file
27
ts/do.classes.doaccount.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as plugins from './do.plugins';
|
||||
|
||||
export class DigitalOceanAccount {
|
||||
token: string;
|
||||
|
||||
constructor(tokenArg: string) {
|
||||
this.token = tokenArg;
|
||||
}
|
||||
|
||||
/**
|
||||
* the main request method used
|
||||
*/
|
||||
async request(routeArg: string, methodArg: string, payloadArg?: any) {
|
||||
const response = await plugins.smartrequest.request(
|
||||
`https://api.digitalocean.com/v2${routeArg}`,
|
||||
{
|
||||
method: methodArg,
|
||||
headers: {
|
||||
Authorization: `Bearer ${this.token}`,
|
||||
'Content-Type': `application/json`
|
||||
},
|
||||
requestBody: payloadArg
|
||||
}
|
||||
);
|
||||
return response.body;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user