1.0.3 • Published 4 months ago

@octaspace/api.js v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Octaspace API Client Package

@octaspace/api.js

Installation

npm install @octaspace/api.js

Usage

Import necessary classes and functions from the package:

import { Octa, KeyError, UUIDError, ApiError } from '@octaspace/api.js';

Initialize Octa Instance:

const octa = new Octa('your-api-key');

Fetch this from Settings of Cube portal.

Create VPN Service:

Pass type ("wg" or "openvpn") and nodeid (number) as parameter.

const createdVPN = await octa.createVPN('type', 1);

Returns UUID

Get VPN Service Details:

const vpnDetails = await octa.getVPN('uuid');

Stop VPN Service:

await octa.stopVPN('uuid');

Get VPN Node List:

const vpnNodes = await octa.getVPNNodes();

Get Account Details:

const accountDetails = await octa.getAccountInfo();

Get Account Balance:

const accountBalance = await octa.getAccountBalance();

Note: checkout lib/src/types.ts for detail information about what they return.

Error Handling:

  • KeyError: Thrown for issues with the API key. Ex: Wrong API Key
  • UUIDError: Thrown for issues with the UUID.
  • ApiError: Generic API error. Ex: Due to Network Error

License

MIT License - see LICENSE file for details.

1.0.3

4 months ago

1.0.2

5 months ago

1.0.1

6 months ago

1.0.0

6 months ago