Skip to content

Latest commit

 

History

History
126 lines (92 loc) · 2.59 KB

README.md

File metadata and controls

126 lines (92 loc) · 2.59 KB

Node Forecast promise API

CircleCI codecov npm version

A Forecast (https://forecastapp.com) API wrapper for Node.js. Forked from inlight-media/node-forecast-api.

Installation

Via npm:

$ npm install --save forecast-promise

Getting started

You will need a Forecast account, accountId and personal access token.

To find your accountId and generate the token, log into Forecast and go to Developers, then click Create New Personal Access Token.

Usage

const Forecast = require('forecast-promise');
const forecast = new Forecast({
	accountId: '12345',
	token: '54321.abc.1-EXAMPLETOKEN',
});

WhoAmI

forecast.whoAmI().then(user => {
	console.log(user);
});

People

forecast.people().then(people => {
	console.log(people);
});

Clients

forecast.clients().then(clients => {
	console.log(clients);
});

Projects

forecast.projects().then(projects => {
	console.log(projects);
});

Roles

forecast.roles().then(roles => {
	console.log(roles);
});

Assignments

Assignments supports the following options (see below for more details):

  • startDate
  • endDate
var options = {
	startDate: new Date(),
	endDate: new Date(2018, 11, 25),
};
forecast.assignments(options).then(assignments => {
	console.log(assignments);
});

Assignments can also be called without options and will use a default start and end date.

forecast.assignments().then(assignments => {
	console.log(assignments);
});

Milestones

Milestones supports the following options (see below for more details):

  • startDate
  • endDate
var options = {
	startDate: new Date(),
	endDate: new Date(2018, 11, 25),
};
forecast.milestones(options).then(milestones => {
	console.log(milestones);
});

Milestones can also be called without options.

forecast.milestones().then(milestones => {
	console.log(milestones);
});

Options

  • startDate - a native date object, a moment.js date object or an ISO-8601 compatible date string.
  • endDate - a native date object, a moment.js date object or an ISO-8601 compatible date string.