@apolitical/apis-client

Node.js module to interact with Apolitical's APIs

Usage no npm install needed!

<script type="module">
  import apoliticalApisClient from 'https://cdn.skypack.dev/@apolitical/apis-client';
</script>

README

Apolitical APIs Client

Node.js module to interact with Apolitical's APIs

How do I get set up?

Requirements

Requires the following to run:

Initial setup

Clone repository:

git clone git@gitlab.com:apolitical/node-modules/apis-client.git

Install dependencies:

yarn install

Run tests:

yarn test

Usage

Here is a short example on how to use this module.

const fs = require('fs');
const apoliticalAPIsClient = require('@apolitical/apis-client');
require('dotenv').config();

const config = {
  url: `https://beta.apolitical.co/api/people-api`,
  sessionSecret: Buffer.from('base64encodedSessionSecret', 'base64').toString('ascii'),
  pfx: fs.readFileSync('/Users/username/someFolder/certFilename.p12'),
  passphrase: Buffer.from('base64encodedCertPassword', 'base64').toString('ascii'),
}

const { user } = apoliticalAPIsClient.people(config);

let usersBatch = await user.list({ offset: 0, count: 100 });

You can get the session secret from the platform-secrets repo. The PFX file is the one you use on your machine to access beta/rc.

TODOs

  • Add Apolitical Logger to replace console