Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ glesys.email.createAccount({
* [`GleSYSAPI.blockStorage.listTiers()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#blockstoragelisttiers)
* [`GleSYSAPI.blockStorage.resize()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#blockstorageresize)

### colocationRack
* [`GleSYSAPI.colocationRack.list()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#colocationracklist)

### country
* [`GleSYSAPI.country.list()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#countrylist)

Expand Down Expand Up @@ -225,6 +228,11 @@ glesys.email.createAccount({
* [`GleSYSAPI.project.edit()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#projectedit)
* [`GleSYSAPI.project.rename()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#projectrename)

### remoteHands
* [`GleSYSAPI.remoteHands.cancel()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#remotehandscancel)
* [`GleSYSAPI.remoteHands.create()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#remotehandscreate)
* [`GleSYSAPI.remoteHands.list()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#remotehandslist)

### server
* [`GleSYSAPI.server.allowedArguments()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#serverallowedarguments)
* [`GleSYSAPI.server.backup()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#serverbackup)
Expand Down Expand Up @@ -266,6 +274,12 @@ glesys.email.createAccount({
* [`GleSYSAPI.serverDisk.reconfigure()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#serverdiskreconfigure)
* [`GleSYSAPI.serverDisk.updateName()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#serverdiskupdatename)

### shipment
* [`GleSYSAPI.shipment.cancel()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#shipmentcancel)
* [`GleSYSAPI.shipment.create()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#shipmentcreate)
* [`GleSYSAPI.shipment.edit()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#shipmentedit)
* [`GleSYSAPI.shipment.list()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#shipmentlist)

### sshKey
* [`GleSYSAPI.sshKey.add()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#sshkeyadd)
* [`GleSYSAPI.sshKey.list()`](https://github.com/GleSYS/API-docs/wiki/API-Documentation#sshkeylist)
Expand Down
8 changes: 8 additions & 0 deletions lib/endpoints/colocationrack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Endpoint } from '../endpoint.js';

export class ColocationRack extends Endpoint {
// https://github.com/GleSYS/API-docs/wiki/API-Documentation#colocationracklist
list() {
return this.request.get('/colocationrack/list');
}
}
18 changes: 18 additions & 0 deletions lib/endpoints/remotehands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Endpoint } from '../endpoint.js';

export class RemoteHands extends Endpoint {
// https://github.com/GleSYS/API-docs/wiki/API-Documentation#remotehandscancel
cancel(data) {
return this.request.post('/remotehands/cancel', data);
}

// https://github.com/GleSYS/API-docs/wiki/API-Documentation#remotehandscreate
create(data) {
return this.request.post('/remotehands/create', data);
}

// https://github.com/GleSYS/API-docs/wiki/API-Documentation#remotehandslist
list() {
return this.request.get('/remotehands/list');
}
}
23 changes: 23 additions & 0 deletions lib/endpoints/shipment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { Endpoint } from '../endpoint.js';

export class Shipment extends Endpoint {
// https://github.com/GleSYS/API-docs/wiki/API-Documentation#shipmentcancel
cancel(data) {
return this.request.post('/shipment/cancel', data);
}

// https://github.com/GleSYS/API-docs/wiki/API-Documentation#shipmentcreate
create(data) {
return this.request.post('/shipment/create', data);
}

// https://github.com/GleSYS/API-docs/wiki/API-Documentation#shipmentedit
edit(data) {
return this.request.post('/shipment/edit', data);
}

// https://github.com/GleSYS/API-docs/wiki/API-Documentation#shipmentlist
list() {
return this.request.get('/shipment/list');
}
}
15 changes: 15 additions & 0 deletions lib/glesys.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Account } from './endpoints/account.js';
import { Api } from './endpoints/api.js';
import { Archive } from './endpoints/archive.js';
import { BlockStorage } from './endpoints/blockstorage.js';
import { ColocationRack } from './endpoints/colocationrack.js';
import { Country } from './endpoints/country.js';
import { Customer } from './endpoints/customer.js';
import { Database } from './endpoints/database.js';
Expand All @@ -18,8 +19,10 @@ import { ObjectStorage } from './endpoints/objectstorage.js';
import { PaymentCard } from './endpoints/paymentcard.js';
import { PrivateNetwork } from './endpoints/privatenetwork.js';
import { Project } from './endpoints/project.js';
import { RemoteHands } from './endpoints/remotehands.js';
import { Server } from './endpoints/server.js';
import { ServerDisk } from './endpoints/serverdisk.js';
import { Shipment } from './endpoints/shipment.js';
import { SshKey as Sshkey } from './endpoints/sshkey.js';
import { User } from './endpoints/user.js';
import { Vpn } from './endpoints/vpn.js';
Expand Down Expand Up @@ -51,6 +54,10 @@ export class GleSYSAPI {
return new BlockStorage(this.request);
}

get colocationRack() {
return new ColocationRack(this.request);
}

get country() {
return new Country(this.request);
}
Expand Down Expand Up @@ -115,6 +122,10 @@ export class GleSYSAPI {
return new Project(this.request);
}

get remoteHands() {
return new RemoteHands(this.request);
}

get server() {
return new Server(this.request);
}
Expand All @@ -123,6 +134,10 @@ export class GleSYSAPI {
return new ServerDisk(this.request);
}

get shipment() {
return new Shipment(this.request);
}

get sshKey() {
return new Sshkey(this.request);
}
Expand Down
20 changes: 20 additions & 0 deletions test/endpoints/colocationrack.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { ColocationRack } from '../../lib/endpoints/colocationrack.js';
import { Request } from '../../lib/request.js';

describe('endpoints/colocationrack', () => {
let request;
let colocationRack;

beforeEach(() => {
request = new Request();
colocationRack = new ColocationRack(request);
});

test('list()', () => {
const spy = globalThis.setupRequestSpy(request, 'get');

colocationRack.list();

expect(spy).toHaveBeenCalledWith('/colocationrack/list');
});
});
44 changes: 44 additions & 0 deletions test/endpoints/remotehands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { RemoteHands } from '../../lib/endpoints/remotehands.js';
import { Request } from '../../lib/request.js';

describe('endpoints/remotehands', () => {
let request;
let remoteHands;

beforeEach(() => {
request = new Request();
remoteHands = new RemoteHands(request);
});

test('cancel()', () => {
const spy = globalThis.setupRequestSpy(request, 'post');
const data = {
key: 'abc123',
};

remoteHands.cancel(data);

expect(spy).toHaveBeenCalledWith('/remotehands/cancel', data);
});

test('create()', () => {
const spy = globalThis.setupRequestSpy(request, 'post');
const data = {
executionoption: 'asap',
instructions: 'Reboot the server',
servicekeys: ['abc123'],
};

remoteHands.create(data);

expect(spy).toHaveBeenCalledWith('/remotehands/create', data);
});

test('list()', () => {
const spy = globalThis.setupRequestSpy(request, 'get');

remoteHands.list();

expect(spy).toHaveBeenCalledWith('/remotehands/list');
});
});
54 changes: 54 additions & 0 deletions test/endpoints/shipment.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { Shipment } from '../../lib/endpoints/shipment.js';
import { Request } from '../../lib/request.js';

describe('endpoints/shipment', () => {
let request;
let shipment;

beforeEach(() => {
request = new Request();
shipment = new Shipment(request);
});

test('cancel()', () => {
const spy = globalThis.setupRequestSpy(request, 'post');
const data = {
key: 'abc123',
};

shipment.cancel(data);

expect(spy).toHaveBeenCalledWith('/shipment/cancel', data);
});

test('create()', () => {
const spy = globalThis.setupRequestSpy(request, 'post');
const data = {
datacenter: 'Falkenberg',
};

shipment.create(data);

expect(spy).toHaveBeenCalledWith('/shipment/create', data);
});

test('edit()', () => {
const spy = globalThis.setupRequestSpy(request, 'post');
const data = {
key: 'abc123',
trackingid: 'XYZ789',
};

shipment.edit(data);

expect(spy).toHaveBeenCalledWith('/shipment/edit', data);
});

test('list()', () => {
const spy = globalThis.setupRequestSpy(request, 'get');

shipment.list();

expect(spy).toHaveBeenCalledWith('/shipment/list');
});
});
3 changes: 3 additions & 0 deletions test/glesys.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ describe('GleSYSAPI', () => {
expect(glesys.api).toBeDefined();
expect(glesys.archive).toBeDefined();
expect(glesys.blockStorage).toBeDefined();
expect(glesys.colocationRack).toBeDefined();
expect(glesys.country).toBeDefined();
expect(glesys.customer).toBeDefined();
expect(glesys.database).toBeDefined();
Expand All @@ -35,8 +36,10 @@ describe('GleSYSAPI', () => {
expect(glesys.paymentCard).toBeDefined();
expect(glesys.privateNetwork).toBeDefined();
expect(glesys.project).toBeDefined();
expect(glesys.remoteHands).toBeDefined();
expect(glesys.server).toBeDefined();
expect(glesys.serverDisk).toBeDefined();
expect(glesys.shipment).toBeDefined();
expect(glesys.sshKey).toBeDefined();
expect(glesys.user).toBeDefined();
expect(glesys.vpn).toBeDefined();
Expand Down