New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More

luu

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

luu

A Node.js client library for the University of Waterloo's API.

0.2.2
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created

luu

Latest Stable Version License

A Node.js client library for the University of Waterloo's Open Data API.

Installation

npm install --save luu

Usage

Import the Client from luu.

import { Client } from 'luu';

const client = new Client('YOUR_API_KEY');

Or, with require(),

const luu = require('luu');

const client = new luu.Client('YOUR_API_KEY');

Make a request.

// request() returns a promise which resolves to the JSON response from the API
client.request('foodservices/menu')
  .then(console.log)
  .catch(console.error);

You can specify parameters for the endpoint string as well. This library uses sprintf-js to parse the endpoint string. Pre-defined parameterized endpoint strings are exported through Constants.

import { Constants } from 'luu';

client.request(Constants.FS_YEAR_WEEK_MENU, {
  year: 2015,
  week: 2,
}).then(console.log);

// equivalent to
client.request('foodservices/%(year)s/%(week)s/menu', {
  year: 2015,
  week: 2,
}).then(console.log);

// specify an array of parameters
client.request(Constants.FS_YEAR_WEEK_MENU, [2015, 2]).then(console.log);

FAQs

Package last updated on 21 Sep 2016

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