1.0.0 • Published 2 years ago

@airbank/gmi-sdk v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@airbank/gmi-sdk

Installation

yarn add @airbank/gmi-sdk

Setup

First you need to setup your api key

import getMyInvoices from "@airbank/gmi-sdk";

getMyInvoices.init({
  apiKey: "0up1-o2br-nrcv-5mrw-zh0a-0m7s-v536",
  mode: "production",
});

There are two values of mode: production and sandbox the default value.

Actions

Create account

Create a new account.

const response = await getMyInvoices.createAccount({
  companyName: "GetMyInvoices",
  email: "max.mustermann@example.org",
  password: "56NBRh8sZLxuJrF",
  firstname: "Max",
  lastname: "Mustermann",
  package: "package_key",
  paymentInterval: "monthly",
  country: 28715,
  language: "de",
  externalId: "10001",
  trialAccount: true,
});

Input

keyTypeRequiredDefaultEnum
companyNamestringTrue
emailstringTrue
passwordstringFalse
firstnamestringTrue
lastnamestringFalse
packagestringTrue
paymentIntervalstringFalsemonthly"monthly" , "yearly"
countrynumberTrue
languagestringTrue"de" , "en"
externalIdstringFalse
trialAccountbooleanFalse

Response Example

// response
{
  "success": true,
  "accountPrimUid": 100,
  "userPrimUid": 110
}

Create GetMyInvoices API key

Create a new API key for that account

const accountPrimUid = 100;
const response = await getMyInvoices.createAccountsAPIKey(accountPrimUid, {
  apiPermission: "FULL_PERMISSION",
  note: "This is note",
});

Response Example

{
  "success": true,
  "apiKeyUid": 42448,
  "accountsApiKey": "gt1h-k8et-xe55-3g82-0gpo-c5sw-stuc",
  "apiPermission": "FULL_PERMISSION",
  "note": "This is note"
}

Get account

Get data for one account.

const accountPrimUid = 100;
const response = await getMyInvoices.getAccount(accountPrimUid);

Response Example

{
  "accountPrimUid": 1,
  "externalId": 10001,
  "companyName": "GetMyInvoices",
  "email": "max.mustermann@example.org",
  "active": true,
  "package": "",
  "paymentInterval": "monthly",
  "addons": "[{'key': 'addon_key', 'amount': 5}]",
  "country": 28715,
  "language": "de",
  "locked": false,
  "numberOfOnlinePortals": 8,
  "usesEmailImport": false,
  "usesInbox": true,
  "created": "2018-01-03",
  "lastLogin": "2018-01-03 14:00:00"
}

Activate account

Activate an account.

const accountPrimUid = 100;
const response = await getMyInvoices.activateAccount(accountPrimUid);

Response Example

{
  "success": true
}

Activate account

Deactivate an account.

const accountPrimUid = 100;
const response = await getMyInvoices.deactivateAccount(accountPrimUid);

Response Example

{
  "success": true
}

Delete account

Delete an account.

const accountPrimUid = 100;
const response = await getMyInvoices.deleteAccount(accountPrimUid);

Response Example

{
  "success": true
}

Get country list

Get list of all available countries.

const response = await getMyInvoices.getCountries();

Response Example

[
  {
    "primUid": 28715,
    "name": "Germany"
  },
  {
    "primUid": 28718,
    "name": "United Kingdom"
  }
]