tickets

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2021 License: GPL-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package tickets provides access to a project's tickets via the Lighthouse API. http://help.lighthouseapp.com/kb/api/tickets.

Index

Constants

View Source
const (
	DefaultLimit = 30
	MaxLimit     = 100
)

Variables

This section is empty.

Functions

func Number added in v0.4.1

func Number(numberStr string) (int, error)

Return ticket number from string, possibly prefixed with #

Types

type AlphabeticalTag

type AlphabeticalTag struct {
	Tag   string
	Count int
}

func (*AlphabeticalTag) MarshalJSON

func (at *AlphabeticalTag) MarshalJSON() ([]byte, error)

func (*AlphabeticalTag) UnmarshalJSON

func (at *AlphabeticalTag) UnmarshalJSON(data []byte) error

type AlphabeticalTags

type AlphabeticalTags []*AlphabeticalTag

type Attachment

type Attachment struct {
	AttachmentFileProcessing bool       `json:"attachment_file_processing"`
	Code                     string     `json:"code"`
	ContentType              string     `json:"content_type"`
	CreatedAt                *time.Time `json:"created_at"`
	Filename                 string     `json:"filename"`
	Height                   int        `json:"height"`
	ID                       int        `json:"id"`
	ProjectID                int        `json:"project_id"`
	Size                     int        `json:"size"`
	UploaderID               int        `json:"uploader_id"`
	Width                    int        `json:"width"`
	URL                      string     `json:"url"`
}

type AttachmentResponse

type AttachmentResponse struct {
	Attachment *Attachment `json:"attachment"`
}

type Attachments

type Attachments []*Attachment

type AttachmentsResponse

type AttachmentsResponse struct {
	Attachments []*AttachmentResponse `json:"attachments"`
}

type BulkEditOptions

type BulkEditOptions struct {
	// This is any search query that is valid on the tickets
	// page. You can also reference all tickets with 'all' or a
	// single ticket with just the ticket's number.  See
	// http://help.lighthouseapp.com/faqs/getting-started/how-do-i-search-for-tickets.
	Query string

	// This is a string of commands using the keywords from Query.
	Command string

	// MigrationToken is the API token of a user that has access
	// to the project that a ticket is migrating to.  If the
	// 'project' or 'account' keywords are not used, this is
	// ignored.  Otherwise, MigrationToken must be set.
	MigrationToken string
}

type DiffableAttributes

type DiffableAttributes struct {
	State        string `json:"state,omitempty"`
	Title        string `json:"title,omitempty"`
	AssignedUser int    `json:"assigned_user,omitempty"`
	Milestone    int    `json:"milestone,omitempty"`
	Tag          string `json:"tag,omitempty"`
}

type ListOptions

type ListOptions struct {
	// Search query, see
	// http://help.lighthouseapp.com/faqs/getting-started/how-do-i-search-for-tickets.
	// Default sort is by last update.
	Query string

	// If non-zero, the number of tickets per page to return.
	// Default is DefaultLimit, max is MaxLimit.
	Limit int

	// If non-zero, the page to return
	Page int
}

type Service

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

func NewService

func NewService(s *lighthouse.Service, projectID int) *Service

func (*Service) AddAttachment

func (s *Service) AddAttachment(t *Ticket, filename string, r io.Reader) error

func (*Service) Create

func (s *Service) Create(t *Ticket) (*Ticket, error)

Only the fields in TicketCreate can be set.

func (*Service) Delete

func (s *Service) Delete(numberStr string) error

Delete ticket using ticket number string, possibly prefixed by #

func (*Service) DeleteByNumber added in v0.4.1

func (s *Service) DeleteByNumber(number int) error

func (*Service) Get

func (s *Service) Get(numberStr string) (*Ticket, error)

Get ticket using ticket number string, possibly prefixed by #

func (*Service) GetAttachment

func (s *Service) GetAttachment(a *Attachment) (io.ReadCloser, error)

func (*Service) GetByNumber added in v0.4.1

func (s *Service) GetByNumber(number int) (*Ticket, error)

func (*Service) List

func (s *Service) List(opts *ListOptions) (Tickets, error)

func (*Service) ListAll

func (s *Service) ListAll(opts *ListOptions) (Tickets, error)

ListAll repeatedly calls List and returns all pages. ListAll ignores opts.Page.

func (*Service) New

func (s *Service) New() (*Ticket, error)

func (*Service) Update

func (s *Service) Update(t *Ticket) error

Only the fields in TicketUpdate can be set.

type Tag

type Tag struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type TagResponse

type TagResponse struct {
	Tag *Tag `json:"tag"`
}

type Tags

type Tags []*Tag

type TagsResponse

type TagsResponse struct {
	Tags []*TagResponse `json:"tags"`
}

type Ticket

type Ticket struct {
	AssignedUserID   int                   `json:"assigned_user_id"`
	AttachmentsCount int                   `json:"attachments_count"`
	Body             string                `json:"body"`
	BodyHTML         string                `json:"body_html"`
	Closed           bool                  `json:"closed"`
	CreatedAt        *time.Time            `json:"created_at"`
	CreatorID        int                   `json:"creator_id"`
	Importance       int                   `json:"importance"`
	MilestoneDueOn   *time.Time            `json:"milestone_due_on"`
	MilestoneID      int                   `json:"milestone_id"`
	MilestoneOrder   int                   `json:"milestone_order"`
	Number           int                   `json:"number"`
	Permalink        string                `json:"permalink"`
	ProjectID        int                   `json:"project_id"`
	RawData          []byte                `json:"raw_data"`
	Spam             bool                  `json:"spam"`
	State            string                `json:"state,omitempty"`
	Tag              string                `json:"tag"`
	Title            string                `json:"title"`
	UpdatedAt        *time.Time            `json:"updated_at"`
	UserID           int                   `json:"user_id"`
	Version          int                   `json:"version"`
	WatchersIDs      []int                 `json:"watchers_ids"`
	UserName         string                `json:"user_name"`
	CreatorName      string                `json:"creator_name"`
	AssignedUserName string                `json:"assigned_user_name"`
	URL              string                `json:"url"`
	MilestoneTitle   string                `json:"milestone_title"`
	Priority         int                   `json:"priority"`
	ImportanceName   string                `json:"importance_name"`
	OriginalBody     string                `json:"original_body"`
	LatestBody       string                `json:"latest_body"`
	OriginalBodyHTML string                `json:"original_body_html"`
	StateColor       string                `json:"state_color"`
	Tags             []*TagResponse        `json:"tags"`
	AlphabeticalTags AlphabeticalTags      `json:"alphabetical_tags"`
	Versions         TicketVersions        `json:"versions"`
	Attachments      []*AttachmentResponse `json:"attachments"`
}

type TicketCreate

type TicketCreate struct {
	Title          string `json:"title"`
	Body           string `json:"body"`
	State          string `json:"state,omitempty"`
	AssignedUserID int    `json:"assigned_user_id,omitempty"`
	MilestoneID    int    `json:"milestone_id,omitempty"`
	Tag            string `json:"tag"`

	// See:
	// http://help.lighthouseapp.com/discussions/api-developers/196-change-ticket-notifications
	NotifyAll        *bool `json:"notify_all,omitempty"`
	MultipleWatchers []int `json:"multiple_watchers,omitempty"`
}

type TicketUpdate

type TicketUpdate struct {
	*Ticket

	NotifyAll        *bool `json:"notify_all,omitempty"`
	MultipleWatchers []int `json:"multiple_watchers,omitempty"`
}

type TicketVersion

type TicketVersion struct {
	AssignedUserID     int                 `json:"assigned_user_id"`
	AttachmentsCount   int                 `json:"attachments_count"`
	Body               string              `json:"body"`
	BodyHTML           string              `json:"body_html"`
	Closed             bool                `json:"closed"`
	CreatedAt          *time.Time          `json:"created_at"`
	CreatorID          int                 `json:"creator_id"`
	DiffableAttributes *DiffableAttributes `json:"diffable_attributes,omitempty"`
	Importance         int                 `json:"importance"`
	MilestoneID        int                 `json:"milestone_id"`
	MilestoneOrder     int                 `json:"milestone_order"`
	Number             int                 `json:"number"`
	Permalink          string              `json:"permalink"`
	ProjectID          int                 `json:"project_id"`
	RawData            []byte              `json:"raw_data"`
	Spam               bool                `json:"spam"`
	State              string              `json:"state,omitempty"`
	Tag                string              `json:"tag"`
	Title              string              `json:"title"`
	UpdatedAt          *time.Time          `json:"updated_at"`
	UserID             int                 `json:"user_id"`
	Version            int                 `json:"version"`
	WatchersIDs        []int               `json:"watchers_ids"`
	UserName           string              `json:"user_name"`
	CreatorName        string              `json:"creator_name"`
	URL                string              `json:"url"`
	Priority           int                 `json:"priority"`
	StateColor         string              `json:"state_color"`
}

type TicketVersions

type TicketVersions []*TicketVersion

type Tickets

type Tickets []*Ticket

Jump to

Keyboard shortcuts

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