1.66.0 • Published 2 years ago

@gem.co/api v1.66.0

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

Official Gem API Node.js Client

The official Node.js client for the Gem API.

Install

npm install @gem.co/api

Quickstart

Server

// Set the SDK constants.
const { GEM_API_KEY, GEM_API_SECRET } = process.env;
const { Gem } = require('@gem.co/api').SDK;

// Create client instance.
const gem = new Gem({
  apiKey: GEM_API_KEY,
  secretKey: GEM_API_SECRET,
  environment: 'sandbox',
});

/**
 *
 * MAIN
 *
 **/

(async () => {
  try {
    const applicationUsers = await gem.listUsers();
    const firstUser = applicationUsers[0];
    const transactions = await gem.listTransactions({ userId: firstUser.id });

    console.log('User Transactions', transactions);
  } catch (e) {
    console.error('Gem Error', e);
  }
})();

Client API Reference

Constructor

const gem = new Gem({
  /* Configuration Parameters */
});

Configuration Parameters:

parameterdescription
apiKeyGem API key for the respective environment.
secretKeyGem API secret for the respective environment.
environmentThe Gem API environment. Options: sandbox or production.
optionsConfiguration options that are passed to the Axios Client for each request made to the API.

SDK Requests

Users

methodparametersdescription
getUser(userId: string)Get a user by ID.
listUsers(pageNumber?: number, pageSize?: number)List all users

Profiles

methodparametersdescription
createProfile( userId: string, profile: ProfileModel )Create a profile.

Documents

methodparametersdescription
createProfileDocument( profileId: string, document: FormData )Attach a document to a profile. (Documents may have many files associated.)

Institutions

methodparametersdescription
getInstitution( institutionId: string )Get an institution by ID.
listInstitutionsnoneList all supported institutions.

Transactions

methodparametersdescription
getTransaction( transactionId: string )Get a transaction by ID.
listTransactions({ userId?: string, accountId?: string, beforeId?: string, afterId?: string, limit?: number }?: object)Get a list of transactions.

Assets

methodparametersdescription
getAssets( assetId: string, source?: string )Get assets from a source. assetIds can be a comma seperated list.
listAssets( category: 'cryptocurrency' or 'fiat' )List all supported assets of a certain category.

Payment Methods + Supported Currencies

methodparametersdescription
listSupportedCurrencies(institutionId: wyre or coinify)List payment methods for a particular institution and their supported currencies.

Prices

methodparametersdescription
getAssetPrice( assetId: string, currencyId: string, source?: string )Get an asset price in units of a requested currency.
listAssetPrices( assetIds: string, currencyId: string, source?: string )List asset prices in units of a requested currency.

Vanilla Requests

Each function makes a request to Gem's API and returns a promise in response.

const gem = new Gem({
  /* Configuration Parameters */
});

const client = gem.client;

client.get(path, parameters, options);
client.post(path, body, options);
client.put(path, body, options);
client.patch(path, body, options);
client.delete(path, body, options);

Debugging

Setting the DEBUG environment variable will turn on Gem client debug logging.

  DEBUG=gem:* node bin/my_program
1.66.0

2 years ago

1.64.3

2 years ago

1.65.0

2 years ago

1.65.1

2 years ago

1.65.2

2 years ago

1.65.3

2 years ago

1.65.4

2 years ago

1.64.0

3 years ago

1.64.1

3 years ago

1.64.2

3 years ago

1.63.0

3 years ago

1.62.6

3 years ago

1.62.4

3 years ago

1.62.5

3 years ago

1.62.2

3 years ago

1.62.3

3 years ago

1.62.1

3 years ago

1.62.0

3 years ago

1.61.0

3 years ago

1.60.1

3 years ago

1.60.0

3 years ago

1.59.0

3 years ago

1.58.0

3 years ago

1.57.0

3 years ago

1.56.0

3 years ago

1.55.0

3 years ago

1.54.2

3 years ago

1.54.1

3 years ago

1.54.0

3 years ago

1.53.3

3 years ago

1.53.2

3 years ago

1.52.1

3 years ago

1.52.0

3 years ago

1.51.0

3 years ago

1.50.0

3 years ago

1.49.0

3 years ago

1.48.2

3 years ago

1.48.1

3 years ago

1.48.0

3 years ago

1.47.0

3 years ago

1.46.0

4 years ago

1.45.0

4 years ago

1.44.0

4 years ago

1.43.0

4 years ago

1.42.0

4 years ago

1.41.0

4 years ago

1.39.0

4 years ago

1.40.0

4 years ago

1.40.1

4 years ago

1.38.0

4 years ago

1.37.0

4 years ago

1.36.0

4 years ago

1.35.1

4 years ago

1.35.0

4 years ago

1.34.0

4 years ago

1.33.1

4 years ago

1.33.2

4 years ago

1.33.0

4 years ago

1.32.0

4 years ago

1.31.0

4 years ago

1.30.3

4 years ago

1.30.2

4 years ago

1.30.1

4 years ago

1.30.0

4 years ago

1.29.0

4 years ago

1.28.0

4 years ago

1.27.0

4 years ago

1.26.0

4 years ago

1.25.0

4 years ago

1.25.0-beta.3

4 years ago

1.25.0-beta.2

4 years ago

1.25.0-beta.1

4 years ago

1.25.0-alpha.3

4 years ago

1.25.0-alpha.2

4 years ago

1.25.0-alpha.1

4 years ago

1.25.0-alpha

4 years ago

1.24.0

4 years ago

1.23.0

4 years ago

1.22.0

4 years ago

1.21.0

4 years ago

1.20.1

4 years ago

1.20.0

4 years ago

1.19.0

4 years ago

1.18.1

4 years ago

1.18.0

4 years ago

1.17.8

4 years ago

1.17.7

4 years ago

1.17.6

4 years ago

1.17.5

4 years ago

1.17.4

4 years ago

1.17.3

4 years ago

1.17.2

4 years ago

1.17.1

4 years ago

1.17.0

4 years ago

1.16.0

4 years ago

1.15.1

4 years ago

1.15.0

4 years ago

1.14.0

4 years ago

1.13.0

4 years ago

1.12.1

4 years ago

1.12.0

4 years ago

1.11.0

4 years ago

1.10.1

4 years ago

1.9.1

4 years ago

1.8.2

4 years ago

1.9.0

4 years ago

1.8.1

4 years ago

1.8.0

4 years ago

1.8.6

4 years ago

1.8.5

4 years ago

1.8.4

4 years ago

1.8.3

4 years ago

1.7.1

4 years ago

1.7.0

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago