npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ylift

v2.12.0

Published

Y LIFT API Client

Downloads

61

Readme

Y LIFT Javascript Client

Version Build Status Downloads Try on RunKit

A JavaScript interface to the Y LIFT API. To get started install via npm:

npm install --save ylift

Getting Started

First, you'll need to register a client application. This can currently only be done by reaching out to the engineering team.

Single Page Apps

const ylift = require('ylift');

const client = ylift.create({
  clientId: 'CLIENT_ID',
  redirectUri: 'http://www.example.com/oauth/callbacks/ylift'
});

// Send the user to the authorization URL, where they can choose to grant your
// app permissions to access the service on their behalf (if permission has
// already been given, they'll automatically be redirected)
window.location = client.getAuthorizeUri('token');

// token will be returned as the query param `authToken` to your redirect URL
const querystring = require('query-string');
const parsed = querystring.parse(location.hash);
client.setAccessToken(parsed.access_token);

NOTE: The process of token retrieval will need to be performed again when the token becomes invalid (they're currently valid for 24 hours).

Server Applications

Because servers can be trusted to keep a secret, setup is much more straightforward.

Client Authentication:

const ylift = require('ylift');

const client = ylift.create({
  clientId: 'CLIENT_ID',
  clientSecret: 'CLIENT_SECRET'
});

Acting on behalf of a user:

const redirectUrl = client.getAuthorizeUri('code');

// Send the user to the authorization URL, where they can choose to grant your
// app permissions to access the service on their behalf (if permission has
// already been given, they'll automatically be redirected)

// the code to exchange will be returned as the query param `code` to your
// redirect URL
const querystring = require('query-string');
const parsed = querystring.parse(location.search);
client.setAuthorizationCode(parsed.code);

Parameters

| Parameter | Usage | Example | |-----------|-------|---------| | clientId* | Registered Client ID | '46ef9d9b-89a9-4fd2-84cf-af6de31f2618' | | clientSecret | Registered Client Secret | '59170c3e-e2c9-4244-92d8-c3595d4af325' | | baseApiUrl | Specify an alternate server to request resources from | 'https://stage.api.ylift.com/v1' | | baseAuthUrl | Specify an alternate server to request auth tokens from | 'https://stage.accounts.ylift.com' | | redirectUri | Path to redirect auth requests to (required for #get_authorize_uri) | 'https://app.example.com/oauth/callbacks/ylift' | | request | axios is used under the hood, pass a config through here | |

Basic Usage

client.products.get('SOME_PRODUCT_ID')
  .then(product => console.log(product))
  .catch(err => console.log('Got an error!', err));

Resources

Notes

  • * and bolded Type indicates required param
  • All list resources have a max of 50 elements per request (e.g. limits higher than that will have no effect)

| Entity | Method Base | |--------|-------------| TODO