0.0.3 • Published 17 days ago

@koibanx/gasstation-sdk v0.0.3

Weekly downloads
-
License
ISC
Repository
gitlab
Last release
17 days ago

Koibanx GasStation SDK

GasStation SDK based in module GasStation

Description

The Module GasStation handles:

SDK Documentation

Feast yourself

Installation

npm install @koibanx/gasstation-sdk

NOTE: you must have the npm token in your .npmrc file

Initialization

Node

Using ES6 import

import GasStationSdk from '@koibanx/gasstation-sdk';

const gasstation = GasStationSdk({
  baseURL: 'http://your-url',
});

With require

exports.__esModule = true;
const GasStationSdk = require('@koibanx/gasstation-sdk')["default"];

const gasstation = GasStationSdk({
  baseURL: 'http://your-url',
});

Types

  • Typescript (@koibanx/gasstation-sdk/dist/index.d.ts)

Examples

Using ES6 import

import GasStationSdk from "@koibanx/gasstation-sdk";

const gasStationSDK = GasStationSdk({
    baseURL: 'http://your-url',
})

const catchError = (err, modulo) => {
  console.log('Modulo: ', modulo);
  console.log('details: ', err.details);
  console.log('shortMessage: ', err.message);
  console.log('errorCode: ', err.code);
}

gasStationSDK.fuelAddress({
  budgetAllowance: '632d473fd495d81a986aeb6b',
  amount: 1,
  callback: 'http://localhost:5000',
  address: 'T4BXW4H4Z6SVCCHDBQ7O3PUEYJYFQH4TXACJPJHCTSXKY2LJ6AFJ6UCKVU',
}).then((data) => {
  console.log('fuelAddress', JSON.stringify(data.status));
}).catch((e) => catchError(e, 'fuelAddress'));

gasStationSDK.getFuelReserve().then((data) => {
  console.log('getFuelReserve', JSON.stringify(data.balance));
}).catch((e) => catchError(e, 'getFuelReserve'));

gasStationSDK.fuelAddress({
  budgetAllowance: '632d473fd495d81a986aeb6b',
  amount: 1,
  callback: 'http://localhost:5000',
  address: 'T4BXW4H4Z6SVCCHDBQ7O3PUEYJYFQH4TXACJPJHCTSXKY2LJ6AFJ6UCKVU',
}).then((resFuel) => {
  gasStationSDK.getTransaction({ id: resFuel._id })
    .then((res) => console.log('getTransaction', JSON.stringify(res.status)))
    .catch((e) => catchError(e, 'getTransaction'));
}).catch((e) => catchError(e, 'fuelAddress'));
0.0.3

17 days ago

0.0.2

10 months ago

0.0.1

2 years ago