1.0.1 • Published 8 years ago

workfrom v1.0.1

Weekly downloads
10
License
-
Repository
github
Last release
8 years ago

workfrom NPM version Build Status Dependency Status

Workfrom.co API client for Node.js

workfrom is a high-level library for interacting with the Workfrom API.

Works on all major Node versions- we test 0.10, 0.12, 4.0, 5.0, and 6.0.

Getting started

Install via npm

$ npm i --save workfrom

Create a client instance

import Workfrom from 'workfrom'; // or: var Workfrom = require('workfrom')

let wf = Workfrom({
  id: 'abcdef1234567890' // replace with your Workfrom appid
});

Documentation

Methods are namespaced under endpoints, which logically separate things you can interact with.

Generally, the interface is laid out as [endpoint].[method].

places.get

Get information on a specific place

wf.places.get({ id: 9075 })
  .then(place => { /* do stuff */ });

wf.places.get({ slug: 'venice-grind' })
  .then(place => { /* do stuff */ });
ParameterTypeRequired?Notes
idInteger or Stringyes*mutually exclusive with slug
slugStringyes*mutually exclusive with id

places.search

Search for places by name

wf.places.search({ name: 'Starbucks', limit: 10, page: 2 })
  .then(results => { /* do stuff */ });
ParameterTypeRequired?Notes
nameStringyes
limitIntegernodefaults to 20
pageIntegernodefaults to 1

places.near

Search for places near a location

wf.places.near({ postalCode: 94104, limit: 10, page: 1 })
  .then(results => { /* do stuff */ });

wf.places.near({ lat: '37.783575', long: '-122.409048', radius: 2 })
  .then(results => { /* do stuff */ });
ParameterTypeRequired?Notes
latStringyes*required if postalCode is omitted
longStringyes*required if postalCode is omitted
postalCodeInteger or Stringyes*required if lat & long are omitted
radiusIntegernoin miles, defaults to 5; not allowed alongside postalCode
limitIntegernodefaults to 20; not allowed alongside lat/long
pageIntegernodefaults to 1; not allowed alongside lat/long

Contributing

Pull requests are welcome, provided that documentation and tests are updated to match any changes made.