Node.js module to interact with Apolitical's APIs
Requires the following to run:
Clone repository:
git clone git@gitlab.com:apolitical/node-modules/apis-client.git
Install dependencies:
yarn install
Run tests:
yarn test
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.
- Add Apolitical Logger to replace
console