types

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ExitSuccess   = 0
	ExitGeneral   = 1
	ExitArgError  = 2
	ExitAuthError = 3
	ExitRetryable = 4
	ExitNotFound  = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppError

type AppError struct {
	Code       string `json:"code"`
	Message    string `json:"message"`
	ExitCode   int    `json:"exitCode"`
	RetryAfter int    `json:"retryAfter,omitempty"`
}

func NewArgError

func NewArgError(msg string) *AppError

func NewAuthError

func NewAuthError(msg string) *AppError

func NewGeneralError

func NewGeneralError(msg string) *AppError

func NewNotFoundError

func NewNotFoundError(msg string) *AppError

func NewRetryableError

func NewRetryableError(msg string, retryAfter int) *AppError

func (*AppError) Error

func (e *AppError) Error() string

type Article added in v0.3.0

type Article struct {
	ID         int64     `json:"id"`
	Title      string    `json:"title"`
	Body       string    `json:"body,omitempty"`
	AuthorID   int64     `json:"author_id,omitempty"`
	SectionID  int64     `json:"section_id,omitempty"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
	Promoted   bool      `json:"promoted"`
	Draft      bool      `json:"draft"`
	HTMLURL    string    `json:"html_url,omitempty"`
	LabelNames []string  `json:"label_names,omitempty"`
	Locale     string    `json:"locale,omitempty"`
}

type ArticlePage added in v0.3.0

type ArticlePage struct {
	Articles []Article `json:"articles"`
	Meta     PageMeta  `json:"meta"`
	Links    PageLinks `json:"links"`
	Count    int       `json:"count,omitempty"`
}

type ArticleResult added in v0.3.0

type ArticleResult struct {
	Article Article `json:"article"`
}

type ArticleSearchPage added in v0.3.0

type ArticleSearchPage struct {
	Results []Article `json:"results"`
	Meta    PageMeta  `json:"meta"`
	Links   PageLinks `json:"links"`
	Count   int       `json:"count,omitempty"`
}

type Attachment added in v0.3.0

type Attachment struct {
	ID          int64        `json:"id"`
	FileName    string       `json:"file_name"`
	ContentURL  string       `json:"content_url"`
	ContentType string       `json:"content_type"`
	Size        int64        `json:"size"`
	Inline      bool         `json:"inline"`
	Width       int          `json:"width,omitempty"`
	Height      int          `json:"height,omitempty"`
	Thumbnails  []Attachment `json:"thumbnails,omitempty"`
}

func (Attachment) HumanSize added in v0.4.5

func (a Attachment) HumanSize() string

HumanSize returns a human-readable file size string.

func (Attachment) IsImage added in v0.4.5

func (a Attachment) IsImage() bool

IsImage returns true if the attachment has an image content type.

type CollaboratorEntry added in v0.4.5

type CollaboratorEntry struct {
	UserID int64
	Email  string
	Name   string
}

CollaboratorEntry represents a CC recipient for ticket comments. It can be a user ID, an email address, or a name+email pair.

func (CollaboratorEntry) MarshalJSON added in v0.4.5

func (c CollaboratorEntry) MarshalJSON() ([]byte, error)

type Comment

type Comment struct {
	ID          int64        `json:"id,omitempty"`
	Body        string       `json:"body"`
	HTMLBody    string       `json:"html_body,omitempty"`
	PlainBody   string       `json:"plain_body,omitempty"`
	Type        string       `json:"type,omitempty"`
	Public      *bool        `json:"public,omitempty"`
	AuthorID    int64        `json:"author_id,omitempty"`
	Attachments []Attachment `json:"attachments,omitempty"`
	CreatedAt   time.Time    `json:"created_at,omitempty"`
}

type CommentPage added in v0.3.0

type CommentPage struct {
	Comments []Comment `json:"comments"`
	Users    []User    `json:"users,omitempty"`
	Meta     PageMeta  `json:"meta"`
	Links    PageLinks `json:"links"`
}

type CreateTicketRequest

type CreateTicketRequest struct {
	Subject        string        `json:"subject"`
	Comment        Comment       `json:"comment"`
	Priority       string        `json:"priority,omitempty"`
	Type           string        `json:"type,omitempty"`
	Status         string        `json:"status,omitempty"`
	AssigneeID     int64         `json:"assignee_id,omitempty"`
	GroupID        int64         `json:"group_id,omitempty"`
	Tags           []string      `json:"tags,omitempty"`
	CustomFields   []CustomField `json:"custom_fields,omitempty"`
	RequesterEmail string        `json:"-"`
	RequesterName  string        `json:"-"`
	Requester      *Requester    `json:"requester,omitempty"`
}

type CustomField

type CustomField struct {
	ID    int64       `json:"id"`
	Value interface{} `json:"value"`
}

type GetTicketOptions

type GetTicketOptions struct {
	Include string
}

type ListArticlesOptions added in v0.3.0

type ListArticlesOptions struct {
	Limit     int
	Cursor    string
	SortBy    string
	SortOrder string
}

type ListCommentsOptions added in v0.3.0

type ListCommentsOptions struct {
	Limit     int
	Cursor    string
	SortOrder string
	Include   string
}

type ListTicketsOptions

type ListTicketsOptions struct {
	Limit     int
	Cursor    string
	Sort      string
	SortOrder string
	Status    string
	Assignee  int64
	Group     int64
	Include   string
}
type PageLinks struct {
	Next string `json:"next,omitempty"`
	Prev string `json:"prev,omitempty"`
}

type PageMeta

type PageMeta struct {
	HasMore      bool   `json:"has_more"`
	AfterCursor  string `json:"after_cursor,omitempty"`
	BeforeCursor string `json:"before_cursor,omitempty"`
}

type Requester

type Requester struct {
	Email string `json:"email,omitempty"`
	Name  string `json:"name,omitempty"`
}

type SearchArticlesOptions added in v0.3.0

type SearchArticlesOptions struct {
	Limit  int
	Cursor string
}

type SearchOptions

type SearchOptions struct {
	Limit     int
	Cursor    string
	SortBy    string
	SortOrder string
	Export    bool
	Include   string
}

type SearchPage

type SearchPage struct {
	Results []SearchResult `json:"results"`
	Users   []User         `json:"users,omitempty"`
	Meta    PageMeta       `json:"meta"`
	Links   PageLinks      `json:"links"`
	Count   int            `json:"count"`
}

type SearchResult

type SearchResult struct {
	Ticket
	ResultType string `json:"result_type"`
}

type Ticket

type Ticket struct {
	ID             int64         `json:"id"`
	URL            string        `json:"url,omitempty"`
	Subject        string        `json:"subject"`
	Description    string        `json:"description,omitempty"`
	Status         string        `json:"status"`
	Priority       string        `json:"priority,omitempty"`
	Type           string        `json:"type,omitempty"`
	RequesterID    int64         `json:"requester_id,omitempty"`
	AssigneeID     int64         `json:"assignee_id,omitempty"`
	GroupID        int64         `json:"group_id,omitempty"`
	OrganizationID int64         `json:"organization_id,omitempty"`
	Tags           []string      `json:"tags,omitempty"`
	CustomFields   []CustomField `json:"custom_fields,omitempty"`
	CreatedAt      time.Time     `json:"created_at"`
	UpdatedAt      time.Time     `json:"updated_at"`
}

type TicketPage

type TicketPage struct {
	Tickets []Ticket  `json:"tickets"`
	Users   []User    `json:"users,omitempty"`
	Meta    PageMeta  `json:"meta"`
	Links   PageLinks `json:"links"`
	Count   int       `json:"count,omitempty"`
}

type TicketResult added in v0.2.0

type TicketResult struct {
	Ticket Ticket `json:"ticket"`
	Users  []User `json:"users,omitempty"`
}

type UpdateTicketRequest

type UpdateTicketRequest struct {
	Subject                 string              `json:"subject,omitempty"`
	Comment                 *Comment            `json:"comment,omitempty"`
	Priority                string              `json:"priority,omitempty"`
	Status                  string              `json:"status,omitempty"`
	AssigneeID              *int64              `json:"assignee_id,omitempty"`
	GroupID                 *int64              `json:"group_id,omitempty"`
	Tags                    []string            `json:"tags,omitempty"`
	AddTags                 []string            `json:"additional_tags,omitempty"`
	RemoveTags              []string            `json:"remove_tags,omitempty"`
	CustomFields            []CustomField       `json:"custom_fields,omitempty"`
	AdditionalCollaborators []CollaboratorEntry `json:"additional_collaborators,omitempty"`
	SafeUpdate              bool                `json:"safe_update,omitempty"`
}

type User added in v0.2.0

type User struct {
	ID     int64  `json:"id"`
	Name   string `json:"name"`
	Email  string `json:"email"`
	Role   string `json:"role"`
	Active bool   `json:"active"`
}

Jump to

Keyboard shortcuts

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