sunburst.js
Sunburst API client library for JavaScript
This library provides authorization handling and methods for accessing the Sunburst API from SunsetWx.
- Supports Node.js, React Native, and popular web browsers.
Platform Support
Platform | Version |
---|---|
Node.js | 6.5+ |
React Native | 0.54+ |
Installation and usage
JavaScript in-browser script tag usage:
- Place
dist/sunburst.iife.js
into your website's files.
<!-- The library is exposed as a global variable: SunburstJS -->
Installation using npm:
npm i sunburst.js
Node.js 8.10+ usage:
const SunburstJS = ;
Node.js 6.5+ usage:
const SunburstJS = ;
Usage with React Native or your favorite module bundler:
;
Getting started
Create a session pair. Also known as clientId
and clientSecret
, which are our API keys:
async { try const sunburst = ; const session = await sunburst; console; catch ex // Handle general network or parsing errors. return console; };
Now you can make API requests:
let sunburst = clientId: 'f78fe615-8eb1-48c4-be21-e5f4f437e8ba' clientSecret: '18qwl0htsPX|[!NGQ@[qK{X;[&^EVzaH' scope: 'predictions';
Here is an example of making four quality prediction requests:
async { try const now = ; const thisTimeTomorrow = now; const resp = await sunburst; resp; catch ex // Handle general network or parsing errors. return console; };
More examples, for each endpoint: https://sunburst.sunsetwx.com/v1/docs
License
The source code is available under the ISC License.