api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HumanSize added in v1.0.1

func HumanSize(n int64) string

HumanSize formats a byte count for display.

func StripControl added in v1.0.1

func StripControl(s string) string

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 Category

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

Category represents a Backlog category.

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 NewClient

func NewClient(spaceURL, apiKey string) *Client

NewClient creates a new Backlog API client.

func (*Client) AddComment

func (c *Client) AddComment(issueIDOrKey string, content string) (*Comment, error)

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

func (c *Client) DownloadSharedFile(projectIDOrKey string, fileID int) (string, []byte, error)

DownloadSharedFile downloads a shared file.

func (*Client) GetCategories

func (c *Client) GetCategories(projectIDOrKey string) ([]Category, error)

GetCategories returns categories for a project.

func (*Client) GetComments

func (c *Client) GetComments(issueIDOrKey string, count int, order string) ([]Comment, error)

GetComments returns comments for an issue.

func (*Client) GetDocument added in v1.0.1

func (c *Client) GetDocument(documentID string) (*Document, error)

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

func (c *Client) GetDocuments(projectID int, keyword string, count int) ([]Document, error)

GetDocuments returns documents of a project, optionally filtered by keyword.

func (*Client) GetIssue

func (c *Client) GetIssue(issueIDOrKey string) (*Issue, error)

GetIssue returns a single issue by key or ID.

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

func (c *Client) GetIssueTypes(projectIDOrKey string) ([]IssueType, error)

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

func (c *Client) GetMilestones(projectIDOrKey string) ([]Milestone, error)

GetMilestones returns milestones for a project.

func (*Client) GetMyself

func (c *Client) GetMyself() (*User, error)

GetMyself returns the authenticated user.

func (*Client) GetPriorities

func (c *Client) GetPriorities() ([]Priority, error)

GetPriorities returns all priorities.

func (*Client) GetProject

func (c *Client) GetProject(projectIDOrKey string) (*Project, error)

GetProject returns a single project.

func (*Client) GetProjectUsers

func (c *Client) GetProjectUsers(projectIDOrKey string) ([]User, error)

GetProjectUsers returns users belonging to a project.

func (*Client) GetProjects

func (c *Client) GetProjects() ([]Project, error)

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

func (c *Client) GetStatuses(projectIDOrKey string) ([]Status, error)

GetStatuses returns statuses for a project.

func (*Client) GetWiki added in v1.0.1

func (c *Client) GetWiki(wikiID int) (*Wiki, error)

GetWiki returns a single wiki page including its content.

func (*Client) GetWikis added in v1.0.1

func (c *Client) GetWikis(projectIDOrKey, keyword string) ([]Wiki, error)

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 Priority

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

Priority represents a Backlog priority.

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

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

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 {
	ID      int    `json:"id"`
	Type    string `json:"type"`
	Dir     string `json:"dir"`
	Name    string `json:"name"`
	Size    int64  `json:"size"`
	Updated string `json:"updated"`
}

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 Tag added in v1.0.1

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

Tag represents a tag on a document or wiki page.

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.

Jump to

Keyboard shortcuts

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