package module
v1.1.0 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2017 License: Apache-2.0 Imports: 11 Imported by: 0



A Forecast ( API Client For Go.


To use the Forecast API, you need:

Next, construct an API:

api := forecast.New(

Then, make use of the API. Consult godoc for detailed API documentation.


Apache 2.0




This section is empty.


This section is empty.


This section is empty.


type API

type API struct {
	URL       string
	AccountID string
	// contains filtered or unexported fields

API provides access to the API

func New

func New(url string, accountID string, accessToken string) *API

New returns a API that is authenticated with Forecast

func (*API) Account

func (api *API) Account() (*Account, error)

Account returns information about the current Forecast account

func (*API) Assignments

func (api *API) Assignments() (Assignments, error)

Assignments retrieves all assignments for the Forecast account

func (*API) Clients

func (api *API) Clients() (Clients, error)

Clients retrieves all clients in the Forecast account

func (*API) FutureScheduledHours

func (api *API) FutureScheduledHours(from string) (FutureScheduledHours, error)

FutureScheduledHours returns all future scheduled hours using the supplied date as the starting point

func (*API) FutureScheduledHoursForProject

func (api *API) FutureScheduledHoursForProject(from string, projectid int) (FutureScheduledHours, error)

FutureScheduledHoursForProject returns all future scheduled hours for the given project using the supplied date as the starting point

func (*API) Milestones

func (api *API) Milestones() (Milestones, error)

Milestones returns all milestones in the Forecast account

func (*API) People

func (api *API) People() (People, error)

People returns all people being scheduled in Forecast

func (*API) Person

func (api *API) Person(id int) (*Person, error)

Person returns the person with the requested ID

func (*API) Projects

func (api *API) Projects() (Projects, error)

Projects returns the list of projects in the Forecast Account

func (*API) RemainingBudgetedHours

func (api *API) RemainingBudgetedHours() (RemainingBudgetedHours, error)

RemainingBudgetedHours returns the remaining budgeted hours for all Forecast projects

func (*API) RepeatedAssignmentSet

func (api *API) RepeatedAssignmentSet(id int) (*RepeatedAssignmentSet, error)

RepeatedAssignmentSet returns the repeated assignment set for the given id

func (*API) RepeatedAssignmentSets

func (api *API) RepeatedAssignmentSets() (RepeatedAssignmentSets, error)

RepeatedAssignmentSets returns a list of repeated assignment sets

func (*API) Subscription

func (api *API) Subscription() (*Subscription, error)

Subscription returns information about the Forecast account subscription

func (*API) UserConnections

func (api *API) UserConnections() (UserConnections, error)

UserConnections returns all current user connections

func (*API) WhoAmI

func (api *API) WhoAmI() (*CurrentUser, error)

WhoAmI returns the CurrentUser for the logged in Forecast user

type Account

type Account struct {
	ID             int    `json:"id"`
	Name           string `json:"name"`
	WeeklyCapacity int    `json:"weekly_capacity"`
	ColorLabels    []struct {
		Name  string `json:"name"`
		Label string `json:"label"`
	} `json:"color_labels"`
	HarvestSubdomain string `json:"harvest_subdomain"`
	HarvestName      string `json:"harvest_name"`

Account is a Forecast account

type Assignment

type Assignment struct {
	ID                      int       `json:"id"`
	StartDate               string    `json:"start_date"`
	EndDate                 string    `json:"end_date"`
	Allocation              int       `json:"allocation"`
	Notes                   string    `json:"notes"`
	UpdatedAt               time.Time `json:"updated_at"`
	UpdatedByID             int       `json:"updated_by_id"`
	ProjectID               int       `json:"project_id"`
	PersonID                int       `json:"person_id"`
	PlaceholderID           int       `json:"placeholder_id"`
	RepeatedAssignmentSetID int       `json:"repeated_assignment_set_id"`

Assignment is a Forecast assignment

func (*Assignment) Weekdays added in v1.1.0

func (a *Assignment) Weekdays() int

Weekdays returns the number of working days between the start date and end date of the assignment

type Assignments

type Assignments []Assignment

Assignments is a list of assignments

func (Assignments) ToCSV

func (assignments Assignments) ToCSV(w io.Writer) error

ToCSV writes the projects to the supplied writer in CSV format

type Client

type Client struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	HarvestID   int       `json:"harvest_id"`
	Archived    bool      `json:"archived"`
	UpdatedAt   time.Time `json:"updated_at"`
	UpdatedByID int       `json:"updated_by_id"`

Client is a client may have one or more projects

type Clients

type Clients []Client

Clients is a list of clients

type CurrentUser

type CurrentUser struct {
	ID         int   `json:"id"`
	AccountIds []int `json:"account_ids"`

CurrentUser contains information about the current Forecast user

type FutureScheduledHours

type FutureScheduledHours []FutureScheduledHoursItem

FutureScheduledHours is a list of future scheduled hours items

type FutureScheduledHoursItem

type FutureScheduledHoursItem struct {
	ProjectID  int     `json:"project_id"`
	PersonID   int     `json:"person_id"`
	Allocation float64 `json:"allocation"`

FutureScheduledHoursItem is a representation of the future scheduled hours for a project

type Milestone

type Milestone struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Date        string    `json:"date"`
	UpdatedAt   time.Time `json:"updated_at"`
	UpdatedByID int       `json:"updated_by_id"`
	ProjectID   int       `json:"project_id"`

Milestone is a Forecast milestone

type Milestones

type Milestones []Milestone

Milestones is a list of milestones

type People

type People []Person

People is a list of people

type Person

type Person struct {
	ID             int       `json:"id"`
	FirstName      string    `json:"first_name"`
	LastName       string    `json:"last_name"`
	Email          string    `json:"email"`
	Login          string    `json:"login"`
	Admin          bool      `json:"admin"`
	Archived       bool      `json:"archived"`
	Subscribed     bool      `json:"subscribed"`
	AvatarURL      string    `json:"avatar_url"`
	Teams          []string  `json:"teams"`
	UpdatedAt      time.Time `json:"updated_at"`
	UpdatedByID    int       `json:"updated_by_id"`
	HarvestUserID  int       `json:"harvest_user_id"`
	WeeklyCapacity int       `json:"weekly_capacity"`
	WorkingDays    struct {
		Monday    bool `json:"monday"`
		Tuesday   bool `json:"tuesday"`
		Wednesday bool `json:"wednesday"`
		Thursday  bool `json:"thursday"`
		Friday    bool `json:"friday"`
	} `json:"working_days"`
	ColorBlind bool `json:"color_blind"`

Person is a person who is being scheduled in Forecast

type Project

type Project struct {
	ID          int       `json:"id"`
	Name        string    `json:"name"`
	Color       string    `json:"color"`
	Code        string    `json:"code"`
	Notes       string    `json:"notes"`
	StartDate   string    `json:"start_date"`
	EndDate     string    `json:"end_date"`
	HarvestID   int       `json:"harvest_id"`
	Archived    bool      `json:"archived"`
	UpdatedAt   time.Time `json:"updated_at"`
	UpdatedByID int       `json:"updated_by_id"`
	ClientID    int       `json:"client_id"`
	Tags        []string  `json:"tags"`

Project is a Forecast project

type Projects

type Projects []Project

Projects is a list of projects

func (Projects) ToCSV

func (projects Projects) ToCSV(w io.Writer) error

ToCSV writes the projects to the supplied writer in CSV format

type RemainingBudgetedHours

type RemainingBudgetedHours []RemainingBudgetedHoursItem

RemainingBudgetedHours is a list of remaining budgeted hours items

type RemainingBudgetedHoursItem

type RemainingBudgetedHoursItem struct {
	ProjectID    int     `json:"project_id"`
	BudgetBy     string  `json:"budget_by"`
	Hours        float64 `json:"hours"`
	ResponseCode int     `json:"response_code"`

RemainingBudgetedHoursItem is an aggregate representing the remaining budgeted hours for the given Forecast project

type RepeatedAssignmentSet

type RepeatedAssignmentSet struct {
	ID             int    `json:"id"`
	FirstStartDate string `json:"first_start_date"`
	LastEndDate    string `json:"last_end_date"`
	AssignmentIds  []int  `json:"assignment_ids"`

RepeatedAssignmentSet is a repeated assignment set

type RepeatedAssignmentSets

type RepeatedAssignmentSets []RepeatedAssignmentSet

RepeatedAssignmentSets is a list of repeated assignment sets

type Subscription

type Subscription struct {
	NextBillingDate  string `json:"next_billing_date"`
	Amount           int    `json:"amount"`
	AmountPerPerson  int    `json:"amount_per_person"`
	ReceiptRecipient string `json:"receipt_recipient"`
	Status           string `json:"status"`
	PurchasedPeople  int    `json:"purchased_people"`
	Interval         string `json:"interval"`
	Discounts        struct {
		MonthlyPercentage int `json:"monthly_percentage"`
		YearlyPercentage  int `json:"yearly_percentage"`
	} `json:"discounts"`
	Card struct {
		Brand       string `json:"brand"`
		LastFour    string `json:"last_four"`
		ExpiryMonth int    `json:"expiry_month"`
		ExpiryYear  int    `json:"expiry_year"`
	} `json:"card"`
	Address struct {
		Line1      string `json:"line_1"`
		Line2      string `json:"line_2"`
		City       string `json:"city"`
		State      string `json:"state"`
		PostalCode string `json:"postal_code"`
		Country    string `json:"country"`
	} `json:"address"`

Subscription describes the Forecast subscription

type UserConnection

type UserConnection struct {
	ID           int       `json:"id"`
	PersonID     int       `json:"person_id"`
	LastActiveAt time.Time `json:"last_active_at"`

UserConnection includes information about currently connected users

type UserConnections

type UserConnections []UserConnection

UserConnections is a list of UserConnection items

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL