0.2.0 • Published 8 years ago

dronedeploy v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

Drone Deploy Public API CircleCI

See the Drone Deploy getting started guide for more details.

Installing via NPM

npm install --save dronedeploy

Using the API

const DroneDeploy = require('dronedeploy');
const dd = new DroneDeploy({
  key: '{your-key}'
});

Get Plans

dd.getPlans((err, results) => {
  // ...
});

If not all plans are returned, then there will be a nextPage function passed after the results.

dd.getPlans((err, results, nextPage) => {
  if (err) {
    console.log(err);
    return;
  }

  // ...

  if (nextPage) {
    nextPage((err, results, nextPage) => {
      // ...
    });
  }
});

Get All Plans

This will keep making requests until an array of all plans is returned. This can be slow.

The second paramater is fired on every page result, and is optional.

dd.getAllPlans((err, allResults) => {
  // ...
}, (err, pageResults) => {
  // ...
});

Get All Plans Within a Bounding Box

If you would like to pull plans that are withing a lat lng bounding box, you can do so with getAllPlansWithinBoundingBox. This can be slow.

The first argument should be the top left lat lng pair, while the second is the bottom right.

const start = {
  lat: 42.3006245,
  lng: -88.4479582
};
const stop = {
  lat: 41.5530922,
  lng: -87.2100356
};

dd.getAllPlansWithinBoundingBox(start, stop, (err, results) => {
  // ...
});

Get a Single Plan

dd.getPlan('id', (err, result) => {
  // ...
});

Get a Plan's Exports

The result may be an empty array. This can be slow.

dd.getPlanExports('planId', (err, results) => {
  // ...
})

Get Exports

The exports need to be manually conducted in the app, before you can pull them via the API.

dd.getExports((err, results) => {
  // ...
})

If not all exports are returned, then there will be a nextPage function passed after the results.

dd.getExports((err, results, nextPage) => {
  if (err) {
    console.log(err);
    return;
  }

  // ...

  if (nextPage) {
    nextPage((err, results, nextPage) => {
      // ...
    });
  }
});

Get All Exports

This will keep making requests until an array of all exports is returned. This can be slow.

The second paramater is fired on every page result, and is optional.

dd.getAllExports((err, allResults) => {
  // ...
}, (err, pageResults) => {
  // ...
});

Get a Single Export

dd.getExport('id', (err, result) => {
  // ...
})

Paramaters

The API docs are very new, and very sparse.

Here is a list of known query paramaters:

keyrequireddescription
api_keyyesYour API key. This is auto-set by the DroneDeploy class, as in the above examples
limitnoNumber, maximum number of records to return (when getting all plans or exports)
page_startnoThis is applied when paging through records, but can be set manually to a Date int, to force an offset

To pass a custom query param (like limit), you must pass a custom object before the callback.

dd.getPlans({
  limit: 5
}, (err, results) => {
  // ...
});

Paramaters are only accepted on getPlans and getExports. The nextPage functions do not accept paramaters, since they inherit that of the original call.

0.2.0

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.1

8 years ago