pivotal

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Copyright (C) 2015 Scott Devoid
Copyright (C) 2015 Salsita Software

Copyright (c) 2014 Salsita Software Copyright (C) 2015 Scott Devoid Use of this source code is governed by the MIT License. The license can be found in the LICENSE file.

Index

Constants

View Source
const (
	ProjectTypePublic  = "public"
	ProjectTypePrivate = "private"
	ProjectTypeDemo    = "demo"
)
View Source
const (
	StoryTypeFeature = "feature"
	StoryTypeBug     = "bug"
	StoryTypeChore   = "chore"
	StoryTypeRelease = "release"
)
View Source
const (
	StoryStateUnscheduled = "unscheduled"
	StoryStatePlanned     = "planned"
	StoryStateUnstarted   = "unstarted"
	StoryStateStarted     = "started"
	StoryStateFinished    = "finished"
	StoryStateDelivered   = "delivered"
	StoryStateAccepted    = "accepted"
	StoryStateRejected    = "rejected"
)
View Source
const (
	LibraryVersion = "0.0.1"
)
View Source
const PageLimit = 10

Number of items to fetch at once when getting paginated response.

Variables

View Source
var ErrNoTrailingSlash = errors.New("trailing slash missing")

Functions

This section is empty.

Types

type AccountingType added in v1.3.0

type AccountingType string
const (
	AccountingTypeUnbillable AccountingType = "unbillable"
	AccountingTypeBillable   AccountingType = "billable"
	AccountingTypeOverhead   AccountingType = "overhead"
)

type Client

type Client struct {

	// Me service
	Me *MeService

	// Project service
	Projects *ProjectService

	// Story service
	Stories *StoryService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(apiToken string) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlPath string, body interface{}) (*http.Request, error)

func (*Client) SetBaseURL

func (c *Client) SetBaseURL(baseURL string) error

func (*Client) SetUserAgent

func (c *Client) SetUserAgent(agent string)

type Comment

type Comment struct {
	Id                  int        `json:"id,omitempty"`
	StoryId             int        `json:"story_id,omitempty"`
	EpicId              int        `json:"epic_id,omitempty"`
	PersonId            int        `json:"person_id,omitempty"`
	Text                string     `json:"text,omitempty"`
	FileAttachmentIds   []int      `json:"file_attachment_ids,omitempty"`
	GoogleAttachmentIds []int      `json:"google_attachment_ids,omitempty"`
	CommitType          string     `json:"commit_type,omitempty"`
	CommitIdentifier    string     `json:"commit_identifier,omitempty"`
	CreatedAt           *time.Time `json:"created_at,omitempty"`
	UpdatedAt           *time.Time `json:"updated_at,omitempty"`
}

type Date added in v1.3.1

type Date time.Time

func (Date) MarshalJson added in v1.3.1

func (date Date) MarshalJson() ([]byte, error)

func (*Date) UnmarshalJSON added in v1.3.1

func (date *Date) UnmarshalJSON(content []byte) error

type Day added in v1.3.0

type Day string
const (
	DayMonday    Day = "Monday"
	DayTuesday   Day = "Tuesday"
	DayWednesday Day = "Wednesday"
	DayThursday  Day = "Thursday"
	DayFriday    Day = "Friday"
	DaySaturday  Day = "Saturday"
	DaySunday    Day = "Sunday"
)

type ErrAPI

type ErrAPI struct {
	Response *http.Response
	Err      *Error
}

func (*ErrAPI) Error

func (err *ErrAPI) Error() string

type ErrFieldNotSet

type ErrFieldNotSet struct {
	// contains filtered or unexported fields
}

func (*ErrFieldNotSet) Error

func (err *ErrFieldNotSet) Error() string

type Error

type Error struct {
	Code             string `json:"code"`
	Error            string `json:"error"`
	Requirement      string `json:"requirement"`
	GeneralProblem   string `json:"general_problem"`
	PossibleFix      string `json:"possible_fix"`
	ValidationErrors []struct {
		Field   string `json:"field"`
		Problem string `json:"problem"`
	} `json:"validation_errors"`
}

type Label

type Label struct {
	Id        int        `json:"id,omitempty"`
	ProjectId int        `json:"project_id,omitempty"`
	Name      string     `json:"name,omitempty"`
	CreatedAt *time.Time `json:"created_at,omitempty"`
	UpdatedAt *time.Time `json:"updated_at,omitempty"`
	Kind      string     `json:"kind,omitempty"`
}

type Me

type Me struct {
	Id                         int        `json:"id"`
	Name                       string     `json:"name"`
	Initials                   string     `json:"initials"`
	Username                   string     `json:"username"`
	TimeZone                   *TimeZone  `json:"time_zone"`
	ApiToken                   string     `json:"api_token"`
	HasGoogleIdentity          bool       `json:"has_google_identity"`
	ProjectIds                 *[]int     `json:"project_ids"`
	WorkspaceIds               *[]int     `json:"workspace_ids"`
	Email                      string     `json:"email"`
	ReceivedInAppNotifications bool       `json:"receives_in_app_notifications"`
	CreatedAt                  *time.Time `json:"created_at"`
	UpdatedAt                  *time.Time `json:"updated_at"`
}

type MeService

type MeService struct {
	// contains filtered or unexported fields
}

func (*MeService) Get

func (service *MeService) Get() (*Me, *http.Response, error)

type Person

type Person struct {
	Id       int    `json:"id,omitempty"`
	Name     string `json:"name,omitempty"`
	Email    string `json:"email,omitempty"`
	Initials string `json:"initials,omitempty"`
	Username string `json:"username,omitempty"`
	Kind     string `json:"kind,omitempty"`
}

type Project added in v1.3.0

type Project struct {
	Id                           int            `json:"id"`
	Name                         string         `json:"name"`
	Version                      int            `json:"version"`
	IterationLength              int            `json:"iteration_length"`
	WeekStartDay                 Day            `json:"week_start_day"`
	PointScale                   string         `json:"point_scale"`
	PointScaleIsCustom           bool           `json:"point_scale_is_custom"`
	BugsAndChoresAreEstimatable  bool           `json:"bugs_and_chores_are_estimatable"`
	AutomaticPlanning            bool           `json:"automatic_planning"`
	EnableTasks                  bool           `json:"enable_tasks"`
	StartDate                    *Date          `json:"start_date"`
	TimeZone                     *TimeZone      `json:"time_zone"`
	VelocityAveragedOver         int            `json:"velocity_averaged_over"`
	ShownIterationsStartTime     *time.Time     `json:"shown_iterations_start_time"`
	StartTime                    *time.Time     `json:"start_time"`
	NumberOfDoneIterationsToShow int            `json:"number_of_done_iterations_to_show"`
	HasGoogleDomain              bool           `json:"has_google_domain"`
	Description                  string         `json:"description"`
	ProfileContent               string         `json:"profile_content"`
	EnableIncomingEmails         bool           `json:"enable_incoming_emails"`
	InitialVelocity              int            `json:"initial_velocity"`
	ProjectType                  string         `json:"project_type"`
	Public                       bool           `json:"public"`
	AtomEnabled                  bool           `json:"atom_enabled"`
	CurrentIterationNumber       int            `json:"current_iteration_number"`
	CurrentVelocity              int            `json:"current_velocity"`
	CurrentVolatility            float64        `json:"current_volatility"`
	AccountId                    int            `json:"account_id"`
	AccountingType               AccountingType `json:"accounting_type"`
	Featured                     bool           `json:"featured"`
	StoryIds                     []int          `json:"story_ids"`
	EpicIds                      []int          `json:"epic_ids"`
	MembershipIds                []int          `json:"membership_ids"`
	LabelIds                     []int          `json:"label_ids"`
	IntegrationIds               []int          `json:"integration_ids"`
	IterationOverrideNumbers     []int          `json:"iteration_override_numbers"`
	CreatedAt                    *time.Time     `json:"created_at"`
	UpdatedAt                    *time.Time     `json:"updated_at"`
}

type ProjectService added in v1.3.0

type ProjectService struct {
	// contains filtered or unexported fields
}

func (*ProjectService) Get added in v1.3.0

func (service *ProjectService) Get(projectId int) (*Project, *http.Response, error)

func (*ProjectService) List added in v1.3.0

func (service *ProjectService) List() ([]*Project, *http.Response, error)

List returns all active projects for the current user.

type Story

type Story struct {
	Id            int        `json:"id,omitempty"`
	ProjectId     int        `json:"project_id,omitempty"`
	Name          string     `json:"name,omitempty"`
	Description   string     `json:"description,omitempty"`
	Type          string     `json:"story_type,omitempty"`
	State         string     `json:"current_state,omitempty"`
	Estimate      *float64   `json:"estimate,omitempty"`
	AcceptedAt    *time.Time `json:"accepted_at,omitempty"`
	Deadline      *time.Time `json:"deadline,omitempty"`
	RequestedById int        `json:"requested_by_id,omitempty"`
	OwnerIds      []int      `json:"owner_ids,omitempty"`
	LabelIds      []int      `json:"label_ids,omitempty"`
	Labels        []*Label   `json:"labels,omitempty"`
	TaskIds       []int      `json:"task_ids,omitempty"`
	Tasks         []int      `json:"tasks,omitempty"`
	FollowerIds   []int      `json:"follower_ids,omitempty"`
	CommentIds    []int      `json:"comment_ids,omitempty"`
	CreatedAt     *time.Time `json:"created_at,omitempty"`
	UpdatedAt     *time.Time `json:"updated_at,omitempty"`
	IntegrationId int        `json:"integration_id,omitempty"`
	ExternalId    string     `json:"external_id,omitempty"`
	URL           string     `json:"url,omitempty"`
}

type StoryCursor

type StoryCursor struct {
	// contains filtered or unexported fields
}

func (*StoryCursor) Next

func (c *StoryCursor) Next() (s *Story, err error)

Next returns the next story.

In case there are no more stories, io.EOF is returned as an error.

type StoryRequest

type StoryRequest struct {
	Name        string    `json:"name,omitempty"`
	Description string    `json:"description,omitempty"`
	Type        string    `json:"story_type,omitempty"`
	State       string    `json:"current_state,omitempty"`
	Estimate    *float64  `json:"estimate,omitempty"`
	OwnerIds    *[]int    `json:"owner_ids,omitempty"`
	LabelIds    *[]int    `json:"label_ids,omitempty"`
	Labels      *[]*Label `json:"labels,omitempty"`
	TaskIds     *[]int    `json:"task_ids,omitempty"`
	Tasks       *[]int    `json:"tasks,omitempty"`
	FollowerIds *[]int    `json:"follower_ids,omitempty"`
	CommentIds  *[]int    `json:"comment_ids,omitempty"`
}

type StoryService

type StoryService struct {
	// contains filtered or unexported fields
}

func (*StoryService) AddComment

func (service *StoryService) AddComment(
	projectId int,
	storyId int,
	comment *Comment,
) (*Comment, *http.Response, error)

func (*StoryService) AddTask

func (service *StoryService) AddTask(projectId, storyId int, task *Task) (*http.Response, error)

func (*StoryService) Get

func (service *StoryService) Get(projectId, storyId int) (*Story, *http.Response, error)

func (*StoryService) Iterate

func (service *StoryService) Iterate(projectId int, filter string) (c *StoryCursor, err error)

Iterate returns a cursor that can be used to iterate over the stories specified by the filter. More stories are fetched on demand as needed.

func (*StoryService) List

func (service *StoryService) List(projectId int, filter string) ([]*Story, error)

List returns all stories matching the filter in case the filter is specified.

List actually sends 2 HTTP requests - one to get the total number of stories, another to retrieve the stories using the right pagination setup. The reason for this is that the filter might require to fetch all the stories at once to get the right results. Since the response as generated by Pivotal Tracker is not always sorted when using a filter, this approach is required to get the right data. Not sure whether this is a bug or a feature.

func (*StoryService) ListComments added in v1.4.0

func (service *StoryService) ListComments(
	projectId int,
	storyId int,
) ([]*Comment, *http.Response, error)

ListComments returns the list of Comments in a Story.

func (*StoryService) ListOwners

func (service *StoryService) ListOwners(projectId, storyId int) ([]*Person, *http.Response, error)

func (*StoryService) ListTasks

func (service *StoryService) ListTasks(projectId, storyId int) ([]*Task, *http.Response, error)

func (*StoryService) Update

func (service *StoryService) Update(projectId, storyId int, story *StoryRequest) (*Story, *http.Response, error)

type Task

type Task struct {
	Id          int        `json:"id,omitempty"`
	StoryId     int        `json:"story_id,omitempty"`
	Description string     `json:"description,omitempty"`
	Position    int        `json:"position,omitempty"`
	Complete    bool       `json:"complete,omitempty"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	UpdatedAt   *time.Time `json:"updated_at,omitempty"`
}

type TimeZone

type TimeZone struct {
	OlsonName string `json:"olson_name,omitempty"`
	Offset    string `json:"offset,omitempty"`
}

Jump to

Keyboard shortcuts

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