JavaScript API client for flippa.com.
JavaScript Makefile Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
scripts
src
test
.gitignore
.npmignore
CHANGELOG.md
Dockerfile
Makefile
README.md
package.json
webpack.config.js

README.md

flippa

JavaScript API client for the Flippa.com API.

Installation

npm install --save flippa

Authentication

An access token can be requested using one of the supported OAuth2 grants:

flippa = new Flippa();
flippa
  .authenticate({
    grant_type: "client_credentials",
    client_id: "123",
    client_secret: "shh"
  })
  .then(function(response) {
    // Authentication succeeded; can now make authorized requests.
    console.log(flippa.accessToken());
  })

The granted access token is stored in the client instance, meaning subsequent requests using the same client do not need to authenticate again.

Alternately, the API client can be provided an access token directly when constructed:

flippa = new Flippa({accessToken: "some_token"});

Examples

Retrieving open listings by user 123:

flippa
  .listings
  .list({filter: {status: "open", user_id: 123}})
  .then(function(response) {
    console.log(response.body.data);
  })

For more usage examples, see the documentation.

Timeout

All requests timeout after 15s by default. This is configurable via the timeout option (in ms).

Example:

// set default timeout to 10s
var flippa = new Flippa({timeout: 10000});

Development

Running tests:

$ make build test

Contributing

This project follows semantic versioning.

In order to make a change, do so from a feature branch and pull request the project. Your pull request should not include a version change. Instead, make an addition to the "head" version in the CHANGELOG that briefly describes the change and ideally links to the pull request.

When releasing a new version, bump the version according to semver in package.json, then push and publish it:

$ TAG=v1.2.3 make build test publish tag