Skip to content

ripplefm/ripple.fm-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ripple.fm

Javascript client for the ripple.fm REST API. Supports using existing access tokens and will request a refresh if the current access token expires. The token storage method is up to the application.

Installation

yarn add ripple.fm

or

npm install --save ripple.fm

Configuration

To begin using the API client we must configure and create an instance.

Simple Example

import api from 'ripple.fm';

function myRefreshFunction() {
  // refresh access token here
}

const ripple = api.create({
  access: "some-token", // optional access token
  baseURL: "https://api.ripple.fm", // ripple.fm core api base url
  authURL: "https://accounts.ripple.fm", // accounts api base url
  onAccessTokenExpire: myRefreshFunction // access tokens are short lived and need to be refreshed
});

// begin using api
async function() {
  const stations = await ripple.getStations();
}

onAccessTokenExpire Implementation Example

An example of the configuration and refreshing access tokens in production is available here.

About

Javascript client library for ripple.fm API

Resources

Stars

Watchers

Forks

Packages

No packages published