Socket
Socket
Sign inDemoInstall

@gem.co/api

Package Overview
Dependencies
66
Maintainers
5
Versions
135
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gem.co/api

Node.js client library for the Gem API.


Version published
Weekly downloads
20
decreased by-37.5%
Maintainers
5
Install size
7.13 MB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 23 Mar 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc