codebase

package
v0.0.0-...-7389dfa Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2015 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHANGE_ASSIGNEE   = "assignee"
	CHANGE_CATEGORY   = "category"
	CHANGE_MILESTONE  = "milestone"
	CHANGE_NEW_TICKET = "new ticket"
	CHANGE_PRIORITY   = "priority"
	CHANGE_STATUS     = "status"
)
View Source
const (
	TYPE_NEW_TICKET = "ticketing_ticket"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CodeBaseAPI

type CodeBaseAPI struct {
	Project string
	// contains filtered or unexported fields
}

func NewCodeBaseClient

func NewCodeBaseClient(username, apiKey, project string) *CodeBaseAPI

Build new Codebase client to access specific project. Project can be changes later on

func (*CodeBaseAPI) Activities

func (c *CodeBaseAPI) Activities(since time.Time, user User, descriptor Descriptor) (events []Event)

func (*CodeBaseAPI) AuthUser

func (c *CodeBaseAPI) AuthUser() (user User)

Fetch User object for currently authenticated user

func (*CodeBaseAPI) CurrentMilestone

func (c *CodeBaseAPI) CurrentMilestone() (current Milestone)

func (*CodeBaseAPI) Milesones

func (c *CodeBaseAPI) Milesones() (milestones []Milestone)

func (*CodeBaseAPI) NotesForTicket

func (c *CodeBaseAPI) NotesForTicket(id int) []TicketNote

func (*CodeBaseAPI) TicketById

func (c *CodeBaseAPI) TicketById(id int) (ticket Ticket, err error)

func (*CodeBaseAPI) TicketsForMilestone

func (c *CodeBaseAPI) TicketsForMilestone(milestone Milestone) (tickets []Ticket)

func (*CodeBaseAPI) User

func (c *CodeBaseAPI) User(firstName, lastname, username string) (user User)

Fetch User based on first name

func (*CodeBaseAPI) UsersInProject

func (c *CodeBaseAPI) UsersInProject() []User

type Descriptor

type Descriptor interface {
	MapChange(field, before, after string) (description string)
}

type Event

type Event struct {
	Id        int    `xml:"id"`
	Title     string `xml:"title"`
	Date      string `xml:"timestamp"`
	Type      string `xml:"type"`
	HtmlTitle string `xml:"html-title"`
	HtmlText  string `xml:"html-text"`
	UserID    int    `xml:"user-id"`
	UserEmail string `xml:"actor-email"`
	ProjectID int    `xml:"project-id"`
	Deleted   bool   `xml:"deleted"`
	Avatar    string `xml:"avatar-url"`

	Raw struct {
		TicketID         int          `xml:"number"`
		Subject          string       `xml:"subject"`
		Content          string       `xml:"content"`
		Changes          EventChanges `xml:"changes"`
		ProjectPermalink string       `xml:"project-permalink"`
	} `xml:"raw-properties"`
}

func (*Event) Changes

func (e *Event) Changes(descriptor Descriptor) string

func (*Event) Day

func (e *Event) Day() time.Weekday

func (*Event) HasChanges

func (e *Event) HasChanges(descriptor Descriptor) bool

func (*Event) TicketUrl

func (e *Event) TicketUrl(company string) string

type EventChanges

type EventChanges struct {
	Status    []string `json:"status_id" xml:"status-id>status-id"`
	Assignee  []string `json:"assignee_id" xml:"assignee-id>assignee-id"`
	Subject   []string `json:"subject" xml:"subject>subject"`
	Priority  []string `json:"priority_id" xml:"priority-id>priority-id"`
	Milestone []string `json:"milestone_id" xml:"milestone-id>milestone-id"`
	Category  []string `json:"category_id" xml:"category-id>category-id"`
}

type Milestone

type Milestone struct {
	Id            int    `xml:"id"`
	Name          string `xml:"name"`
	StartAt       string `xml:"start-at"`
	Deadline      string `xml:"deadline"`
	Status        string `xml:"status"`
	Description   string `xml:"description"`
	EstimatedTime int64  `xml:"estimated-time"`
}

func (*Milestone) DaysToEnd

func (m *Milestone) DaysToEnd() (int64, error)

func (*Milestone) DaysToEndStr

func (m *Milestone) DaysToEndStr() string

func (*Milestone) DeadlineTime

func (m *Milestone) DeadlineTime() (t time.Time, err error)

func (*Milestone) EstimatedTimeDuration

func (m *Milestone) EstimatedTimeDuration() time.Duration

func (*Milestone) IsActive

func (m *Milestone) IsActive() bool

func (*Milestone) StartAtTime

func (m *Milestone) StartAtTime() (t time.Time, err error)

func (Milestone) String

func (m Milestone) String() string

func (*Milestone) WorkingDaysInSprint

func (m *Milestone) WorkingDaysInSprint() (int64, error)

type Ticket

type Ticket struct {
	Id            int    `xml:"ticket-id"`
	Summary       string `xml:"summary"`
	TicketType    string `xml:"ticket-type"`
	Assignee      string `xml:"assignee"`
	Status        string `xml:"status>name"`
	Priority      string `xml:"priority>name"`
	EstimationRaw string `xml:"estimated-time"`
	Reporter      string `xml:"reporter"`
	Category      string `xml:"category>name"`

	Milestone      Milestone `xml:"milestone"`
	StartOn        string    `xml:"start-on"`
	Deadline       string    `xml:"deadline"`
	UpdatedAt      time.Time `xml:"updated-at"`
	CreatedAt      time.Time `xml:"created-at"`
	TotalTimeSpent int       `xml:"total-time-spent"`
	BlockedBy      []int     `xml:"blocked-by>blocked-by"`
	Blocking       []int     `xml:"blocking>blocking"`
}

func (*Ticket) Estimation

func (t *Ticket) Estimation() int64

func (*Ticket) IsAssigned

func (t *Ticket) IsAssigned() bool

type TicketByAssignee

type TicketByAssignee []Ticket

func (TicketByAssignee) Len

func (t TicketByAssignee) Len() int

func (TicketByAssignee) Less

func (t TicketByAssignee) Less(i, j int) bool

func (TicketByAssignee) Swap

func (t TicketByAssignee) Swap(i, j int)

type TicketNote

type TicketNote struct {
	// Attachements []Attachement
	Content    string    `xml:"content"`
	Id         int       `xml:"id"`
	UpdatedAt  time.Time `xml:"updated-at"`
	CreatedAt  time.Time `xml:"created-at"`
	UserID     int       `xml:"user-id"`
	UpdatesRaw string    `xml:"updates"`
}

func (*TicketNote) Changes

func (t *TicketNote) Changes(descriptor Descriptor) string

func (*TicketNote) ChangesState

func (t *TicketNote) ChangesState() bool

func (*TicketNote) Updates

func (t *TicketNote) Updates() (updates EventChanges)

type User

type User struct {
	FirstName string `xml:"first-name"`
	LastName  string `xml:"last-name"`
	UserName  string `xml:"username"`
	UserID    int    `xml:"id"`
	Email     string `xml:"email-address"`
	Company   string `xml:"company"`
}

func (User) String

func (u User) String() string

Strinify user to "FistName LastName"

type WorkingDays

type WorkingDays time.Time

func (WorkingDays) SinceUnix

func (w WorkingDays) SinceUnix() int64

Jump to

Keyboard shortcuts

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