Skip to main content
Deno 2 is finally here 🎉️
Learn more

Node Forecast promise API

A Forecast (https://forecastapp.com) API wrapper for Deno.js. Forked from dan1elhughes/forecast-promise.

Installation

$ 'https://deno.land/x/forecast_promise/mod.ts'

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

import Forecast from 'https://deno.land/x/forecast_promise@v0.1.2/mod.ts';
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.