Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@people.io/ppl-api-client-js

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@people.io/ppl-api-client-js

Simple client for people.io api

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
2
Weekly downloads
 
Created
Source

ppl-api-client-js

A simple Javascript client for people.io API.

Subscribe to our developer program and obtain your credentials on https://developer.people.io/

Install:

npm install ppl-api-client-js --save

Obtaining a user token:

In order to call the API you will need to act as an authenticated user. A valid implicit oAuth url can be obtained by:

const client = require('ppl-api-client-js');
// Scopes are required to declare the categories of data that your app requires.
// In this case, we are requesting the user to share personal insights about their Brand and Sport interests.
const scope = ['brands', 'sports'];
// Where would you like to have the access token delivered?
// If left blank, the user will be shown an HTML page containing the token.
const destination = "https://myserver.io/tokenCapture";

const url = client.getUserAuthURL(scope, destination);
console.log('User authentication page: ', url);

Configuration:

You can configure the library in two ways:

Programmatically:

Using the configure() method

const client = require('ppl-api-client-js');
const myConfiguration = {
    apiKey: 'my-api-key',
    clientId: 'my-client-id',
    userToken: 'my-user\'s-user-token'
};

// Note: the `configure()` will always return the update configuration state.
// you can update any parameter at any pooint in time ad it will be retained without
// touching the others. You can call it without any param to obtain the current conf state.
const updateConfig = client.configure(testConf);
console.log('ppl-api-client config: ', { updateConfig });

or you can pass the details to each call:

const client = require('ppl-api-client-js');
getUserAudiences(null, { token, apiKey, clientId }).then(console.log).catch(console.error);

Environment Variables:

PPL_API_KEY="my-api-key"
PPL_CLIENT_ID="my-client-id"

Functions list:

All the functions can be used both in an async/await/ or promise fashion

  • getAudiences(name, { limit, page, token, apiKey, clientId })
  • getAudienceGroups(name, { limit, page, token, apiKey, clientId })
  • getUserAudiences(audienceGroupId, { token, apiKey, clientId });

The token, apiKey, and clientId parameters become optional when previously stated or configured. See the above configuration section for more informations.

Testing:

npm test

Development

npm start

Keywords

FAQs

Package last updated on 22 Mar 2019

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc