2.12.0 • Published 5 years ago

ylift v2.12.0

Weekly downloads
18
License
MIT
Repository
github
Last release
5 years ago

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

ParameterUsageExample
clientId*Registered Client ID'46ef9d9b-89a9-4fd2-84cf-af6de31f2618'
clientSecretRegistered Client Secret'59170c3e-e2c9-4244-92d8-c3595d4af325'
baseApiUrlSpecify an alternate server to request resources from'https://stage.api.ylift.com/v1'
baseAuthUrlSpecify an alternate server to request auth tokens from'https://stage.accounts.ylift.com'
redirectUriPath to redirect auth requests to (required for #get_authorize_uri)'https://app.example.com/oauth/callbacks/ylift'
requestaxios 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)
EntityMethod Base

TODO

2.12.0

5 years ago

2.11.0

5 years ago

2.10.0

5 years ago

2.9.0

5 years ago

2.8.0

5 years ago

2.7.0

5 years ago

2.6.0

5 years ago

2.5.0

5 years ago

2.4.0

5 years ago

2.3.0

5 years ago

2.2.3

5 years ago

2.2.2

5 years ago

2.2.1

5 years ago

2.2.0

5 years ago

2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

0.18.0

5 years ago

0.17.1

5 years ago

0.17.0

5 years ago

0.16.0

5 years ago

0.15.0

5 years ago

0.14.0

5 years ago

0.13.0

5 years ago

0.12.0

5 years ago

0.11.0

5 years ago

0.10.0

5 years ago

0.9.1

6 years ago

0.9.0

6 years ago

0.8.3

6 years ago

0.8.2

6 years ago

0.8.1

6 years ago

0.8.0

6 years ago

0.7.1

6 years ago

0.7.0

6 years ago

0.6.0

6 years ago

0.5.0

6 years ago

0.4.1

6 years ago

0.4.0

6 years ago

0.3.18

6 years ago

0.3.17

6 years ago

0.3.16

6 years ago

0.3.15

6 years ago

0.3.14

6 years ago

0.3.13

6 years ago

0.3.12

6 years ago

0.3.11

6 years ago

0.3.10

6 years ago

0.3.9

6 years ago

0.3.8

6 years ago

0.3.7

6 years ago

0.3.6

6 years ago

0.3.5

6 years ago

0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.83

6 years ago

0.1.82

6 years ago

0.1.81

6 years ago

0.1.80

6 years ago

0.1.79

6 years ago

0.1.78

6 years ago

0.1.77

6 years ago

0.1.76

6 years ago

0.1.75

6 years ago

0.1.74

6 years ago

0.1.73

6 years ago

0.1.72

6 years ago

0.1.71

6 years ago

0.1.70

6 years ago

0.1.69

6 years ago

0.1.68

6 years ago

0.1.66

6 years ago

0.1.65

6 years ago

0.1.64

6 years ago

0.1.62

6 years ago

0.1.61

6 years ago

0.1.60

6 years ago

0.1.59

6 years ago

0.1.58

6 years ago

0.1.57

6 years ago

0.1.56

6 years ago

0.1.55

6 years ago

0.1.54

6 years ago

0.1.53

6 years ago

0.1.52

6 years ago

0.1.51

6 years ago

0.1.50

6 years ago

0.1.49

6 years ago

0.1.48

6 years ago

0.1.47

6 years ago

0.1.46

6 years ago

0.1.45

6 years ago

0.1.44

6 years ago

0.1.43

6 years ago

0.1.42

6 years ago

0.1.41

6 years ago

0.1.40

6 years ago

0.1.39

6 years ago

0.1.38

6 years ago

0.1.37

6 years ago

0.1.36

6 years ago

0.1.35

6 years ago

0.1.34

6 years ago

0.1.33

6 years ago

0.1.32

6 years ago

0.1.31

6 years ago

0.1.30

6 years ago

0.1.29

6 years ago

0.1.28

6 years ago

0.1.27

6 years ago

0.1.26

6 years ago

0.1.25

6 years ago

0.1.24

6 years ago

0.1.23

6 years ago

0.1.22

6 years ago

0.1.21

6 years ago

0.1.20

6 years ago

0.1.19

6 years ago

0.1.18

6 years ago

0.1.17

6 years ago

0.1.16

6 years ago

0.1.15

6 years ago

0.1.14

6 years ago

0.1.13

6 years ago

0.1.12

6 years ago

0.1.11

6 years ago

0.1.10

6 years ago

0.1.9

6 years ago

0.1.8

6 years ago

0.1.7

6 years ago

0.1.6

6 years ago

0.1.5

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago