📡 Workfrom.co API client for Node.js
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
test
.babelrc
.editorconfig
.gitattributes
.gitignore
.travis.yml
LICENSE
README.md
gulpfile.js
package.json

README.md

workfrom.js NPM version Build Status Dependency Status

Workfrom.co API client for Node.js

workfrom.js 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 */ });
Parameter Type Required? Notes
id Integer or String yes* mutually exclusive with slug
slug String yes* mutually exclusive with id

places.search

Search for places by name

wf.places.search({ name: 'Starbucks', limit: 10, page: 2 })
  .then(results => { /* do stuff */ });
Parameter Type Required? Notes
name String yes
limit Integer no defaults to 20
page Integer no defaults 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 */ });
Parameter Type Required? Notes
lat String yes* required if postalCode is omitted
long String yes* required if postalCode is omitted
postalCode Integer or String yes* required if lat & long are omitted
radius Integer no in miles, defaults to 5; not allowed alongside postalCode
limit Integer no defaults to 20; not allowed alongside lat/long
page Integer no defaults to 1; not allowed alongside lat/long

Contributing

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