Documentation
¶
Index ¶
- func HumanSize(n int64) string
- func StripControl(s string) string
- type Attachment
- type BacklogError
- type BacklogErrorResponse
- type Category
- type ChangeLog
- type Client
- func (c *Client) AddComment(issueIDOrKey string, content string) (*Comment, error)
- func (c *Client) CreateIssue(opts *CreateIssueOptions) (*Issue, error)
- func (c *Client) DownloadDocumentAttachment(documentID string, attachmentID int) (string, []byte, error)
- func (c *Client) DownloadIssueAttachment(issueIDOrKey string, attachmentID int) (string, []byte, error)
- func (c *Client) DownloadSharedFile(projectIDOrKey string, fileID int) (string, []byte, error)
- func (c *Client) GetCategories(projectIDOrKey string) ([]Category, error)
- func (c *Client) GetComments(issueIDOrKey string, count int, order string) ([]Comment, error)
- func (c *Client) GetDocument(documentID string) (*Document, error)
- func (c *Client) GetDocumentTree(projectIDOrKey string) (*DocumentTree, error)
- func (c *Client) GetDocuments(projectID int, keyword string, count int) ([]Document, error)
- func (c *Client) GetIssue(issueIDOrKey string) (*Issue, error)
- func (c *Client) GetIssueAttachments(issueIDOrKey string) ([]Attachment, error)
- func (c *Client) GetIssueTypes(projectIDOrKey string) ([]IssueType, error)
- func (c *Client) GetIssues(opts *GetIssuesOptions) ([]Issue, error)
- func (c *Client) GetMilestones(projectIDOrKey string) ([]Milestone, error)
- func (c *Client) GetMyself() (*User, error)
- func (c *Client) GetPriorities() ([]Priority, error)
- func (c *Client) GetProject(projectIDOrKey string) (*Project, error)
- func (c *Client) GetProjectUsers(projectIDOrKey string) ([]User, error)
- func (c *Client) GetProjects() ([]Project, error)
- func (c *Client) GetPullRequest(projectIDOrKey, repo string, number int) (*PullRequest, error)
- func (c *Client) GetPullRequests(projectIDOrKey, repo string, count int) ([]PullRequest, error)
- func (c *Client) GetRepositories(projectIDOrKey string) ([]Repository, error)
- func (c *Client) GetSharedFiles(projectIDOrKey, dir string) ([]SharedFile, error)
- func (c *Client) GetStatuses(projectIDOrKey string) ([]Status, error)
- func (c *Client) GetWiki(wikiID int) (*Wiki, error)
- func (c *Client) GetWikis(projectIDOrKey, keyword string) ([]Wiki, error)
- func (c *Client) UpdateIssue(issueIDOrKey string, opts *UpdateIssueOptions) (*Issue, error)
- type Comment
- type CreateIssueOptions
- type CustomField
- type Document
- type DocumentNode
- type DocumentTree
- type GetIssuesOptions
- type Issue
- type IssueType
- type Milestone
- type Priority
- type Project
- type PullRequest
- type PullRequestStatus
- type Repository
- type SharedFile
- type Status
- type Tag
- type UpdateIssueOptions
- type User
- type Wiki
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StripControl ¶ added in v1.0.1
StripControl removes characters that can manipulate a terminal or spoof text: control characters (ESC, CR, C0/C1, DEL), format characters such as bidi overrides (U+202E) and zero-width spaces, and line/paragraph separators. Newlines, tabs and the zero-width joiner used by emoji are kept.
Types ¶
type Attachment ¶ added in v1.0.1
type Attachment struct {
ID int `json:"id"`
Name string `json:"name"`
Size int64 `json:"size"`
CreatedUser *User `json:"createdUser"`
Created string `json:"created"`
}
Attachment represents a file attached to an issue or a document.
type BacklogError ¶
type BacklogError struct {
Message string `json:"message"`
Code int `json:"code"`
MoreInfo string `json:"moreInfo"`
}
BacklogError represents an error response from the Backlog API.
type BacklogErrorResponse ¶
type BacklogErrorResponse struct {
Errors []BacklogError `json:"errors"`
}
BacklogErrorResponse wraps the errors array in the API response.
type ChangeLog ¶
type ChangeLog struct {
Field string `json:"field"`
NewValue string `json:"newValue"`
OriginalValue string `json:"originalValue"`
}
ChangeLog represents a field change in a comment.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Backlog API client.
func (*Client) AddComment ¶
AddComment adds a comment to an issue.
func (*Client) CreateIssue ¶
func (c *Client) CreateIssue(opts *CreateIssueOptions) (*Issue, error)
CreateIssue creates a new issue.
func (*Client) DownloadDocumentAttachment ¶ added in v1.0.1
func (c *Client) DownloadDocumentAttachment(documentID string, attachmentID int) (string, []byte, error)
DownloadDocumentAttachment downloads a document attachment.
func (*Client) DownloadIssueAttachment ¶ added in v1.0.1
func (c *Client) DownloadIssueAttachment(issueIDOrKey string, attachmentID int) (string, []byte, error)
DownloadIssueAttachment downloads an issue attachment.
func (*Client) DownloadSharedFile ¶ added in v1.0.1
DownloadSharedFile downloads a shared file.
func (*Client) GetCategories ¶
GetCategories returns categories for a project.
func (*Client) GetComments ¶
GetComments returns comments for an issue.
func (*Client) GetDocument ¶ added in v1.0.1
GetDocument returns a single document including its body.
func (*Client) GetDocumentTree ¶ added in v1.0.1
func (c *Client) GetDocumentTree(projectIDOrKey string) (*DocumentTree, error)
GetDocumentTree returns the document tree of a project.
func (*Client) GetDocuments ¶ added in v1.0.1
GetDocuments returns documents of a project, optionally filtered by keyword.
func (*Client) GetIssueAttachments ¶ added in v1.0.1
func (c *Client) GetIssueAttachments(issueIDOrKey string) ([]Attachment, error)
GetIssueAttachments returns the attachments of an issue.
func (*Client) GetIssueTypes ¶
GetIssueTypes returns issue types for a project.
func (*Client) GetIssues ¶
func (c *Client) GetIssues(opts *GetIssuesOptions) ([]Issue, error)
GetIssues returns issues matching the given options.
func (*Client) GetMilestones ¶
GetMilestones returns milestones for a project.
func (*Client) GetPriorities ¶
GetPriorities returns all priorities.
func (*Client) GetProject ¶
GetProject returns a single project.
func (*Client) GetProjectUsers ¶
GetProjectUsers returns users belonging to a project.
func (*Client) GetProjects ¶
GetProjects returns all projects.
func (*Client) GetPullRequest ¶ added in v1.0.1
func (c *Client) GetPullRequest(projectIDOrKey, repo string, number int) (*PullRequest, error)
GetPullRequest returns a single pull request.
func (*Client) GetPullRequests ¶ added in v1.0.1
func (c *Client) GetPullRequests(projectIDOrKey, repo string, count int) ([]PullRequest, error)
GetPullRequests returns pull requests of a repository.
func (*Client) GetRepositories ¶ added in v1.0.1
func (c *Client) GetRepositories(projectIDOrKey string) ([]Repository, error)
GetRepositories returns Git repositories of a project.
func (*Client) GetSharedFiles ¶ added in v1.0.1
func (c *Client) GetSharedFiles(projectIDOrKey, dir string) ([]SharedFile, error)
GetSharedFiles returns shared files under dir ("" or "/" for the root).
func (*Client) GetStatuses ¶
GetStatuses returns statuses for a project.
func (*Client) GetWikis ¶ added in v1.0.1
GetWikis returns wiki pages of a project, optionally filtered by keyword.
func (*Client) UpdateIssue ¶
func (c *Client) UpdateIssue(issueIDOrKey string, opts *UpdateIssueOptions) (*Issue, error)
UpdateIssue updates an existing issue.
type Comment ¶
type Comment struct {
ID int `json:"id"`
Content string `json:"content"`
CreatedUser *User `json:"createdUser"`
Created string `json:"created"`
ChangeLog []ChangeLog `json:"changeLog"`
}
Comment represents a Backlog comment.
type CreateIssueOptions ¶
type CreateIssueOptions struct {
ProjectID int
Summary string
IssueTypeID int
PriorityID int
Description string
AssigneeID int
DueDate string
StartDate string
MilestoneIDs []int
CategoryIDs []int
}
CreateIssueOptions holds parameters for CreateIssue.
type CustomField ¶ added in v1.0.1
type CustomField struct {
ID int `json:"id"`
FieldTypeID int `json:"fieldTypeId"`
Name string `json:"name"`
Value json.RawMessage `json:"value"`
}
CustomField represents a custom field value on an issue. Value differs by field type (string, number, object or array), so it is kept raw.
func (CustomField) DisplayValue ¶ added in v1.0.1
func (f CustomField) DisplayValue() string
DisplayValue renders the custom field value as plain text.
type Document ¶ added in v1.0.1
type Document struct {
ID string `json:"id"`
ProjectID int `json:"projectId"`
Title string `json:"title"`
Plain string `json:"plain"`
Emoji string `json:"emoji"`
Attachments []Attachment `json:"attachments"`
Tags []Tag `json:"tags"`
CreatedUser *User `json:"createdUser"`
Created string `json:"created"`
UpdatedUser *User `json:"updatedUser"`
Updated string `json:"updated"`
}
Document represents a Backlog document.
type DocumentNode ¶ added in v1.0.1
type DocumentNode struct {
ID string `json:"id"`
Name string `json:"name"`
Emoji string `json:"emoji"`
Children []DocumentNode `json:"children"`
}
DocumentNode is a node of the document tree.
type DocumentTree ¶ added in v1.0.1
type DocumentTree struct {
ProjectID int `json:"projectId"`
ActiveTree *DocumentNode `json:"activeTree"`
}
DocumentTree is the response of the document tree API.
type GetIssuesOptions ¶
type GetIssuesOptions struct {
ProjectIDs []int
AssigneeIDs []int
StatusIDs []int
MilestoneIDs []int
ParentIDs []int
Keyword string
Count int
Offset int
Sort string
Order string
}
GetIssuesOptions holds parameters for GetIssues.
type Issue ¶
type Issue struct {
ID int `json:"id"`
ProjectID int `json:"projectId"`
IssueKey string `json:"issueKey"`
Summary string `json:"summary"`
Description string `json:"description"`
Status *Status `json:"status"`
Assignee *User `json:"assignee"`
Priority *Priority `json:"priority"`
IssueType *IssueType `json:"issueType"`
DueDate string `json:"dueDate"`
StartDate string `json:"startDate"`
CreatedUser *User `json:"createdUser"`
Created string `json:"created"`
Updated string `json:"updated"`
Milestone []Milestone `json:"milestone"`
Category []Category `json:"category"`
// ParentIssueID is nil when the issue has no parent.
ParentIssueID *int `json:"parentIssueId"`
CustomFields []CustomField `json:"customFields"`
Attachments []Attachment `json:"attachments"`
}
Issue represents a Backlog issue.
type IssueType ¶
type IssueType struct {
ID int `json:"id"`
ProjectID int `json:"projectId"`
Name string `json:"name"`
Color string `json:"color"`
}
IssueType represents a Backlog issue type.
type Milestone ¶
type Milestone struct {
ID int `json:"id"`
ProjectID int `json:"projectId"`
Name string `json:"name"`
ReleaseDueDate string `json:"releaseDueDate"`
}
Milestone represents a Backlog milestone/version.
type Project ¶
type Project struct {
ID int `json:"id"`
ProjectKey string `json:"projectKey"`
Name string `json:"name"`
Description string `json:"description"`
}
Project represents a Backlog project.
type PullRequest ¶ added in v1.0.1
type PullRequest struct {
ID int `json:"id"`
Number int `json:"number"`
Summary string `json:"summary"`
Description string `json:"description"`
Base string `json:"base"`
Branch string `json:"branch"`
Status *PullRequestStatus `json:"status"`
Assignee *User `json:"assignee"`
Issue *struct {
ID int `json:"id"`
IssueKey string `json:"issueKey"`
} `json:"issue"`
CreatedUser *User `json:"createdUser"`
Created string `json:"created"`
Updated string `json:"updated"`
}
PullRequest represents a Backlog Git pull request.
type PullRequestStatus ¶ added in v1.0.1
PullRequestStatus represents the status of a pull request.
type Repository ¶ added in v1.0.1
type Repository struct {
ID int `json:"id"`
ProjectID int `json:"projectId"`
Name string `json:"name"`
Description string `json:"description"`
HTTPURL string `json:"httpUrl"`
SSHURL string `json:"sshUrl"`
Updated string `json:"updated"`
}
Repository represents a Backlog Git repository.
type SharedFile ¶ added in v1.0.1
type SharedFile struct {
}
SharedFile represents a shared file or directory in a project.
type Status ¶
type Status struct {
ID int `json:"id"`
ProjectID int `json:"projectId"`
Name string `json:"name"`
Color string `json:"color"`
}
Status represents a Backlog status.
type UpdateIssueOptions ¶
type UpdateIssueOptions struct {
Summary *string
Description *string
StatusID *int
AssigneeID *int
PriorityID *int
DueDate *string
StartDate *string
MilestoneIDs []int
CategoryIDs []int
Comment *string
}
UpdateIssueOptions holds parameters for UpdateIssue. Pointer types are used to distinguish between unset and zero values.
type User ¶
type User struct {
ID int `json:"id"`
UserID string `json:"userId"`
Name string `json:"name"`
MailAddress string `json:"mailAddress"`
}
User represents a Backlog user.
type Wiki ¶ added in v1.0.1
type Wiki struct {
ID int `json:"id"`
ProjectID int `json:"projectId"`
Name string `json:"name"`
Content string `json:"content"`
Tags []Tag `json:"tags"`
Attachments []Attachment `json:"attachments"`
CreatedUser *User `json:"createdUser"`
Created string `json:"created"`
UpdatedUser *User `json:"updatedUser"`
Updated string `json:"updated"`
}
Wiki represents a Backlog wiki page.