@lonelyplanet/open-planet-node
Node.js client for the Open Planet API.
Last updated 5 months ago by iamtodd .
Original npm · Tarball · package.json
$ cnpm install @lonelyplanet/open-planet-node 
SYNC missed versions from official npm registry.

Open Planet Node

Node.js client for the Open Planet API.

Create a client

Define a few ENV variables...

AUTH_CLIENT_ID=your-client-id
AUTH_HOST=http://connect.qa.lonelyplanet.com
OPENID_HOST=http://connect.qa.lonelyplanet.com
OPEN_PLANET_HOST=http://stable.web.op-api-gateway.qa.lonelyplanet.com

Create a client with...

import createClient from "@lonelyplanet/open-planet-node"

const client = createClient();

Docs

Generate docs with...

npm run docs

Endpoint Examples

User

client.user.find({
  username: "foo.user",
});
client.user.findById("1234");

Bookmark List

client.bookmarkList.findById(":listId");
client.bookmarkList.createList(":userId", { /** list attributes */ });

Filtering

Most endpoints support the following types of filtering...

client.user.find({
  key: "some value",
});
// ?filter[user][key][equals]=some%20value

client.poi.find({
  place_id: {
    has_ancestor: "362228",
  },
});
// ?filter[poi][place_id][has_ancestor]=362228

client.place.find({
  name: {
    like: "nashv",
  },
});
// ?filter[place][name][like]=nashv

Pagination

You can paginate by passing in the following...

client.user.find({
  limit: 10,
  offset: 2
});
// ?page[limit]=10&page[offset]=2

Disable include service caching

If you find yourself getting back cached things via ?include...

client.user.find({
  nocache: true,
});
// ?nocache=true

Pass extra query string arguments

To pass additional non-filter query string arguments, use extras...

client.user.find({
  name: "someusername",
  extras: {
    foo: "bar"
  }
});
// ?filter[user][name][equals]=someusername&foo=bar

Building

npm run build

npm run build -- --watch

Testing

npm run test

Dependency Injection with Inversify and Reflect-Metadata

Make sure to have the following code in the main entrypoint for an application, or included via CDN in the appliaction consuming this library.

import "reflect-metadata";

Open Planet Node uses https://github.com/inversify/InversifyJS for dependency injection whish is depednent upon Reflect.

Current Tags

  • 2.46.1                                ...           latest (5 months ago)

136 Versions

  • 2.46.1                                ...           5 months ago
  • 2.46.0                                ...           a year ago
  • 2.45.1                                ...           a year ago
  • 2.45.0                                ...           a year ago
  • 2.44.0                                ...           a year ago
  • 2.43.0                                ...           a year ago
  • 2.42.0                                ...           2 years ago
  • 2.41.0                                ...           2 years ago
  • 2.40.0                                ...           2 years ago
  • 2.39.0                                ...           2 years ago
  • 2.38.0                                ...           2 years ago
  • 2.37.1                                ...           2 years ago
  • 2.37.0                                ...           2 years ago
  • 2.36.2                                ...           2 years ago
  • 2.36.1                                ...           2 years ago
  • 2.36.0                                ...           2 years ago
  • 2.35.0                                ...           2 years ago
  • 2.34.0                                ...           2 years ago
  • 2.33.0                                ...           2 years ago
  • 2.32.0                                ...           2 years ago
  • 2.31.1                                ...           2 years ago
  • 2.31.0                                ...           2 years ago
  • 2.30.0                                ...           2 years ago
  • 2.29.0                                ...           2 years ago
  • 2.28.0                                ...           2 years ago
  • 2.27.1                                ...           2 years ago
  • 2.27.0                                ...           2 years ago
  • 2.26.2                                ...           2 years ago
  • 2.26.0                                ...           2 years ago
  • 2.25.0                                ...           2 years ago
  • 2.24.17                                ...           2 years ago
  • 2.24.16                                ...           2 years ago
  • 2.24.15                                ...           2 years ago
  • 2.24.14                                ...           2 years ago
  • 2.24.13                                ...           2 years ago
  • 2.24.12                                ...           2 years ago
  • 2.24.11                                ...           2 years ago
  • 2.24.10                                ...           2 years ago
  • 2.24.9                                ...           2 years ago
  • 2.24.8                                ...           2 years ago
  • 2.24.7                                ...           2 years ago
  • 2.24.6                                ...           2 years ago
  • 2.24.5                                ...           2 years ago
  • 2.24.4                                ...           2 years ago
  • 2.24.3                                ...           2 years ago
  • 2.24.2                                ...           2 years ago
  • 2.24.1                                ...           2 years ago
  • 2.24.0                                ...           2 years ago
  • 2.23.0                                ...           2 years ago
  • 2.22.0                                ...           2 years ago
  • 2.21.0                                ...           2 years ago
  • 2.20.0                                ...           2 years ago
  • 2.19.0                                ...           2 years ago
  • 2.18.0                                ...           2 years ago
  • 2.17.0                                ...           2 years ago
  • 2.16.0                                ...           2 years ago
  • 2.15.0                                ...           2 years ago
  • 2.14.0                                ...           2 years ago
  • 2.13.0                                ...           2 years ago
  • 2.12.0                                ...           2 years ago
  • 2.11.0                                ...           2 years ago
  • 2.10.0                                ...           2 years ago
  • 2.9.3                                ...           2 years ago
  • 2.9.2                                ...           2 years ago
  • 2.9.1                                ...           2 years ago
  • 2.9.0                                ...           2 years ago
  • 2.8.1                                ...           2 years ago
  • 2.8.0                                ...           2 years ago
  • 2.7.0                                ...           2 years ago
  • 2.6.1                                ...           2 years ago
  • 2.5.4                                ...           2 years ago
  • 2.5.3                                ...           2 years ago
  • 2.5.2                                ...           2 years ago
  • 2.5.1                                ...           2 years ago
  • 2.4.7                                ...           2 years ago
  • 2.4.6                                ...           2 years ago
  • 2.4.5                                ...           2 years ago
  • 2.4.4                                ...           2 years ago
  • 2.4.3                                ...           3 years ago
  • 2.4.2                                ...           3 years ago
  • 2.4.1                                ...           3 years ago
  • 2.4.0                                ...           3 years ago
  • 2.3.12                                ...           3 years ago
  • 2.3.11                                ...           3 years ago
  • 2.3.10                                ...           3 years ago
  • 2.3.9                                ...           3 years ago
  • 2.3.8                                ...           3 years ago
  • 2.3.7                                ...           3 years ago
  • 2.3.6                                ...           3 years ago
  • 2.3.5                                ...           3 years ago
  • 2.3.4                                ...           3 years ago
  • 2.3.3                                ...           3 years ago
  • 2.3.2                                ...           3 years ago
  • 2.3.1                                ...           3 years ago
  • 2.3.0                                ...           3 years ago
  • 2.2.1                                ...           3 years ago
  • 2.2.0                                ...           3 years ago
  • 2.1.10                                ...           3 years ago
  • 2.1.9                                ...           3 years ago
  • 2.1.8                                ...           3 years ago
  • 2.1.7                                ...           3 years ago
  • 2.1.6                                ...           3 years ago
  • 2.1.5                                ...           3 years ago
  • 2.1.4                                ...           3 years ago
  • 2.1.3                                ...           3 years ago
  • 2.1.2                                ...           3 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.2                                ...           3 years ago
  • 2.0.1                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 1.2.18                                ...           3 years ago
  • 1.2.17                                ...           3 years ago
  • 1.2.16                                ...           3 years ago
  • 1.2.15                                ...           3 years ago
  • 1.2.14                                ...           3 years ago
  • 1.2.13                                ...           3 years ago
  • 1.2.12                                ...           3 years ago
  • 1.2.11                                ...           3 years ago
  • 1.2.9                                ...           3 years ago
  • 1.2.8                                ...           3 years ago
  • 1.2.7                                ...           3 years ago
  • 1.2.6                                ...           3 years ago
  • 1.2.5                                ...           3 years ago
  • 1.2.4                                ...           3 years ago
  • 1.2.3                                ...           3 years ago
  • 1.2.2                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.0                                ...           3 years ago
  • 1.1.6                                ...           3 years ago
  • 1.1.5                                ...           3 years ago
  • 1.1.4                                ...           3 years ago
  • 1.1.3                                ...           3 years ago
  • 1.1.2                                ...           3 years ago
  • 1.1.1                                ...           3 years ago
  • 1.1.0                                ...           3 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 136
Last Month 138
Dependencies (6)
Dev Dependencies (10)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |