client

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

client provides API client for backlog.com.

Index

Constants

View Source
const (
	V2IssuesCountPath       = "/api/v2/issues/count"
	V2IssuesPath            = "/api/v2/issues"
	V2NotificationsPath     = "/api/v2/notifications"
	V2PrioritiesPath        = "/api/v2/priorities"
	V2ProjectsPath          = "/api/v2/projects"
	V2SpaceActivitiesPath   = "/api/v2/space/activities"
	V2SpaceAttachmentPath   = "/api/v2/space/attachment"
	V2SpaceDiskUsagePath    = "/api/v2/space/diskUsage"
	V2SpaceImagePath        = "/api/v2/space/image"
	V2SpaceNotificationPath = "/api/v2/space/notification"
	V2SpacePath             = "/api/v2/space"
	V2UsersPath             = "/api/v2/users"
	V2WikisPath             = "/api/v2/wikis"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client provides API access.

func New added in v0.1.0

func New(space, token string, opts ...OptionFunc) (*Client, error)

New returns API client.

Note: space is your backlog address.

// OK client, _ := client.New("example.backlog.com", "xxxxxxxx")

// OK client, _ := client.New("https://example.backlog.com", "xxxxxxxx")

func (*Client) AddIssue

func (c *Client) AddIssue(issue *Issue, notifiedUsers []*User) (*Issue, error)

AddIssue adds new issue.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/add-issue/#add-issue

func (*Client) AddIssueContext

func (c *Client) AddIssueContext(ctx context.Context, issue *Issue, notifiedUsers []*User) (*Issue, error)

AddIssueContext accepts context.

func (*Client) AddPullRequest

func (c *Client) AddPullRequest(pullRequest *PullRequest, notifiedUsers []*User) (*PullRequest, error)

AddPullRequest Adds pull requests.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/add-pull-request/#add-pull-request

func (*Client) AddPullRequestContext

func (c *Client) AddPullRequestContext(ctx context.Context, pullRequest *PullRequest, notifiedUsers []*User) (*PullRequest, error)

AddPullRequestContext accepts context.

func (*Client) AddWiki added in v0.5.0

func (c *Client) AddWiki(wiki *Wiki, mailNotify bool) (*Wiki, error)

AddWiki adds new Wiki page.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/add-wiki-page/#add-wiki-page

func (*Client) AddWikiAttachments added in v0.6.0

func (c *Client) AddWikiAttachments(wikiId uint64, filepaths ...string) ([]*Attachment, error)

AddWikiAttachments creates and attaches files to Wiki

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/attach-file-to-wiki/#url-parameters

func (*Client) AddWikiAttachmentsContext added in v0.6.0

func (c *Client) AddWikiAttachmentsContext(ctx context.Context, wikiId uint64, filepaths ...string) ([]*Attachment, error)

AddWikiAttachmentsContext accepts context.

func (*Client) AddWikiContext added in v0.5.0

func (c *Client) AddWikiContext(ctx context.Context, wiki *Wiki, mailNotify bool) (*Wiki, error)

AddWikiContext accepts context.

func (*Client) DeleteIssue

func (c *Client) DeleteIssue(issueKeyOrId string) (*Issue, error)

DeleteIssue deletes issue.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/delete-issue/#delete-issue

func (*Client) DeleteIssueContext

func (c *Client) DeleteIssueContext(ctx context.Context, issueKeyOrId string) (*Issue, error)

DeleteIssueContext accepts context.

func (*Client) DeleteWiki added in v0.5.0

func (c *Client) DeleteWiki(wikiId uint64) (*Wiki, error)

DeleteWiki deletes wiki.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/delete-wiki-page/#delete-wiki-page

func (*Client) DeleteWikiAttachment added in v0.5.0

func (c *Client) DeleteWikiAttachment(wikiId, attachmentId uint64) (*Attachment, error)

DeleteWikiAttachment removes files attached to Wiki.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/remove-wiki-attachment/#remove-wiki-attachment

func (*Client) DeleteWikiAttachmentContext added in v0.5.0

func (c *Client) DeleteWikiAttachmentContext(ctx context.Context, wikiId, attachmentId uint64) (*Attachment, error)

DeleteWikiAttachmentContext accepts context.

func (*Client) DeleteWikiContext added in v0.5.0

func (c *Client) DeleteWikiContext(ctx context.Context, wikiId uint64) (*Wiki, error)

DeleteWikiContext accepts context.

func (*Client) DownloadWikiAttachment added in v0.5.0

func (c *Client) DownloadWikiAttachment(wikiId, attachmentId uint64) (data []byte, filename string, err error)

DownloadWikiAttachment download Wiki page’s attachment file.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-attachment/#get-wiki-page-attachment

func (*Client) DownloadWikiAttachmentContext added in v0.5.0

func (c *Client) DownloadWikiAttachmentContext(ctx context.Context, wikiId, attachmentId uint64) (data []byte, filename string, err error)

DownloadWikiAttachmentContext accepts context.

func (*Client) GetAllIssues added in v0.2.0

func (c *Client) GetAllIssues(maxIssues int, query url.Values) ([]*Issue, error)

GetAllIssues returns all issues.

func (*Client) GetAllIssuesContext added in v0.2.0

func (c *Client) GetAllIssuesContext(ctx context.Context, maxIssues int, query url.Values) ([]*Issue, error)

GetAllIssuesContext accepts context.

func (*Client) GetAllPullRequests added in v0.2.0

func (c *Client) GetAllPullRequests(projectIdOrKey, repositoryIdOrName string) ([]*PullRequest, error)

GetAllPullRequests returns all pull requests.

func (*Client) GetAllPullRequestsContext added in v0.2.0

func (c *Client) GetAllPullRequestsContext(ctx context.Context, projectIdOrKey, repositoryIdOrName string) ([]*PullRequest, error)

GetAllPullRequestsContext accepts context.

func (*Client) GetIssue

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

GetIssue returns information about issue.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-issue/#get-issue

func (*Client) GetIssueComments

func (c *Client) GetIssueComments(issueIdOrKey string, query url.Values) ([]*Comment, error)

GetIssueComments returns list of comments in issue.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-comment-list/#get-comment-list

func (*Client) GetIssueCommentsContext

func (c *Client) GetIssueCommentsContext(ctx context.Context, issueIdOrKey string, query url.Values) ([]*Comment, error)

GetIssueCommentsContext accepts context.

func (*Client) GetIssueContext

func (c *Client) GetIssueContext(ctx context.Context, issueKeyOrId string) (*Issue, error)

GetIssueContext accepts context.

func (*Client) GetIssueTypes

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

GetIssueTypes returns list of Issue Types in the project.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-issue-type-list/#get-issue-type-list

func (*Client) GetIssueTypesContext

func (c *Client) GetIssueTypesContext(ctx context.Context, projectIdOrKey string) ([]*IssueType, error)

GetIssueTypesContext accepts context.

func (*Client) GetIssues

func (c *Client) GetIssues(query url.Values) ([]*Issue, error)

GetIssues returns list of issues.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-issue-list/#get-issue-list

func (*Client) GetIssuesContext

func (c *Client) GetIssuesContext(ctx context.Context, query url.Values) ([]*Issue, error)

GetIssuesContext accepts context.

func (*Client) GetIssuesCount

func (c *Client) GetIssuesCount(query url.Values) (int64, error)

GetIssuesCount returns number of issues.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/count-issue/#count-issue

func (*Client) GetIssuesCountContext

func (c *Client) GetIssuesCountContext(ctx context.Context, query url.Values) (int64, error)

GetIssuesCountContext accepts context.

func (*Client) GetMyself

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

GetMyself returns own information about user.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-own-user/#get-own-user

func (*Client) GetMyselfContext

func (c *Client) GetMyselfContext(ctx context.Context) (*User, error)

GetMyselfContext accepts context.

func (*Client) GetNotifications

func (c *Client) GetNotifications(query url.Values) ([]*Notification, error)

GetNotifications returns own notifications.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-notification/#get-notification

func (*Client) GetNotificationsContext

func (c *Client) GetNotificationsContext(ctx context.Context, query url.Values) ([]*Notification, error)

GetNotificationsContext accepts context.

func (*Client) GetPriorities

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

GetPriorities returns list of priorities.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-priority-list/#get-priority-list

func (*Client) GetPrioritiesContext

func (c *Client) GetPrioritiesContext(ctx context.Context) ([]*Priority, error)

GetPrioritiesContext accepts context.

func (*Client) GetProject

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

GetProject returns information about project.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-project/#get-project

func (*Client) GetProjectContext

func (c *Client) GetProjectContext(ctx context.Context, projectKeyOrId string) (*Project, error)

GetProjectContext accepts context.

func (*Client) GetProjectStatuses

func (c *Client) GetProjectStatuses(projectIdOrKey string) ([]*ProjectStatus, error)

GetProjectStatuses returns list of status in the project.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-status-list-of-project/#get-status-list-of-project

func (*Client) GetProjectStatusesContext

func (c *Client) GetProjectStatusesContext(ctx context.Context, projectIdOrKey string) ([]*ProjectStatus, error)

GetProjectStatuses accepts context.

func (*Client) GetProjects

func (c *Client) GetProjects(query url.Values) ([]*Project, error)

GetProjects returns list of projects.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-project-list/#get-project-list

func (*Client) GetProjectsContext

func (c *Client) GetProjectsContext(ctx context.Context, query url.Values) ([]*Project, error)

GetProjectsContext accepts context.

func (*Client) GetPullRequest

func (c *Client) GetPullRequest(projectIdOrKey, repositoryIdOrName string, number int64) (*PullRequest, error)

GetPullRequest returns pull reuqest.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-pull-request/#get-pull-request

func (*Client) GetPullRequestComments

func (c *Client) GetPullRequestComments(projectKeyOrId, repositoryNameOrId string, number int64, query url.Values) ([]*Comment, error)

GetPullRequestComments returns list of pull request comments.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-pull-request-comment/

func (*Client) GetPullRequestCommentsContext

func (c *Client) GetPullRequestCommentsContext(ctx context.Context, projectKeyOrId, repositoryNameOrId string, number int64, query url.Values) ([]*Comment, error)

GetPullRequestCommentsContext accepts context.

func (*Client) GetPullRequestContext

func (c *Client) GetPullRequestContext(ctx context.Context, projectIdOrKey, repositoryIdOrName string, number int64) (*PullRequest, error)

GetPullRequestContext accepts context.

func (*Client) GetPullRequests

func (c *Client) GetPullRequests(projectIdOrKey, repositoryIdOrName string, query url.Values) ([]*PullRequest, error)

GetPullRequests returns list of pull requests.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-pull-request-list/#get-pull-request-list

func (*Client) GetPullRequestsContext

func (c *Client) GetPullRequestsContext(ctx context.Context, projectIdOrKey, repositoryIdOrName string, query url.Values) ([]*PullRequest, error)

GetPullRequestsContext accepts context.

func (*Client) GetPullRequestsCount

func (c *Client) GetPullRequestsCount(projectIdOrKey, repositoryIdOrName string) (int64, error)

GetPullRequestsCount returns number of pull requests.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-number-of-pull-requests/#get-number-of-pull-requests

func (*Client) GetPullRequestsCountContext

func (c *Client) GetPullRequestsCountContext(ctx context.Context, projectIdOrKey, repositoryIdOrName string) (int64, error)

GetPullRequestsCountContext accepts context.

func (*Client) GetRepositories

func (c *Client) GetRepositories(projectKeyOrId string, query url.Values) ([]*Repository, error)

GetRepositories returns list of Git repositories.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-list-of-git-repositories/#get-list-of-git-repositories

func (*Client) GetRepositoriesContext

func (c *Client) GetRepositoriesContext(ctx context.Context, projectKeyOrId string, query url.Values) ([]*Repository, error)

GetRepositoriesContext accepts context.

func (*Client) GetRepository

func (c *Client) GetRepository(projectKeyOrId, repositoryNameOrId string) (*Repository, error)

GetRepository returns Git repository.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-git-repository/

func (*Client) GetRepositoryContext

func (c *Client) GetRepositoryContext(ctx context.Context, projectKeyOrId, repositoryNameOrId string) (*Repository, error)

getRepositoryContext accepts context.

func (*Client) GetSpace

func (c *Client) GetSpace() (*Space, error)

GetSpace returns information about your space.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-space/#get-space

func (*Client) GetSpaceContext

func (c *Client) GetSpaceContext(ctx context.Context) (*Space, error)

GetSpaceContext accepts context.

func (*Client) GetSpaceDiskUsage added in v0.6.0

func (c *Client) GetSpaceDiskUsage() (*TotalDiskUsage, error)

GetSpaceDiskUsage returns information about space disk usage.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-space-disk-usage/#get-space-disk-usage

func (*Client) GetSpaceDiskUsageContext added in v0.6.0

func (c *Client) GetSpaceDiskUsageContext(ctx context.Context) (*TotalDiskUsage, error)

GetSpaceDiskUsageContext accepts context.

func (*Client) GetUsers

func (c *Client) GetUsers() ([]*User, error)

GetUsers returns list of users in your space.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-user-list/#get-user-list

func (*Client) GetUsersContext

func (c *Client) GetUsersContext(ctx context.Context) ([]*User, error)

GetUsersContext accepts context.

func (*Client) GetWiki

func (c *Client) GetWiki(wikiId uint64) (*Wiki, error)

GetWiki returns information about Wiki page.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-wiki-page/

func (*Client) GetWikiAttachments added in v0.5.0

func (c *Client) GetWikiAttachments(wikiId uint64) ([]*Attachment, error)

GetWikiAttachments gets list of files attached to Wiki.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-list-of-wiki-attachments/#status-line-response-header

func (*Client) GetWikiAttachmentsContext added in v0.5.0

func (c *Client) GetWikiAttachmentsContext(ctx context.Context, wikiId uint64) ([]*Attachment, error)

GetWikiAttachmentsContext accepts context.

func (*Client) GetWikiContext

func (c *Client) GetWikiContext(ctx context.Context, wikiId uint64) (*Wiki, error)

GetWikiContext accepts context.

func (*Client) GetWikiCount added in v0.5.0

func (c *Client) GetWikiCount(projectIdOrKey string) (int, error)

GetWikiCount returns number of Wiki pages.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/count-wiki-page/#count-wiki-page

func (*Client) GetWikiCountContext added in v0.5.0

func (c *Client) GetWikiCountContext(ctx context.Context, projectIdOrKey string) (int, error)

GetWikiCountContext accepts context.

func (*Client) GetWikiTags added in v0.5.0

func (c *Client) GetWikiTags(projectIdOrKey string) ([]*Tag, error)

GetWikiTags returns list of tags that are used in the project.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-tag-list/#get-wiki-page-tag-list

func (*Client) GetWikiTagsContext added in v0.5.0

func (c *Client) GetWikiTagsContext(ctx context.Context, projectIdOrKey string) ([]*Tag, error)

GetWikiTagsContext accepts context.

func (*Client) GetWikis

func (c *Client) GetWikis(projectIdOrKey string, query url.Values) ([]*Wiki, error)

GetWikis returns list of Wiki pages.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/get-wiki-page-list/#get-wiki-page-list

func (*Client) GetWikisContext

func (c *Client) GetWikisContext(ctx context.Context, projectIdOrKey string, query url.Values) ([]*Wiki, error)

GetWikisContext accepts context.

func (*Client) PostAttachment added in v0.5.0

func (c *Client) PostAttachment(filepath string) (*Attachment, error)

PostAttachment posts an attachment file for issue or wiki. Returns id of the attachment file.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/post-attachment-file/#post-attachment-file

func (*Client) PostAttachmentContext added in v0.5.0

func (c *Client) PostAttachmentContext(ctx context.Context, filepath string) (*Attachment, error)

PostAttachmentContext accepts context.

func (*Client) UpdateIssue

func (c *Client) UpdateIssue(issue *Issue, notifiedUsers []*User, comment string) (*Issue, error)

UpdateIssue updates information about issue.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/update-issue/#update-issue

func (*Client) UpdateIssueContext

func (c *Client) UpdateIssueContext(ctx context.Context, issue *Issue, notifiedUsers []*User, comment string) (*Issue, error)

UpdateIssueContext accepts context.

func (*Client) UpdatePullRequest

func (c *Client) UpdatePullRequest(pullRequest *PullRequest, notifiedUsers []*User, comment string) (*PullRequest, error)

UpdatePullRequest updates pull requests.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/update-pull-request/#update-pull-request

func (*Client) UpdatePullRequestContext

func (c *Client) UpdatePullRequestContext(ctx context.Context, pullRequest *PullRequest, notifiedUsers []*User, comment string) (*PullRequest, error)

UpdatePullRequestContext accepts context.

func (*Client) UpdateWiki added in v0.5.0

func (c *Client) UpdateWiki(wiki *Wiki, mailNotify bool) (*Wiki, error)

UpdateWiki updates information about Wiki page.

For more details, see the API document.

https://developer.nulab.com/docs/backlog/api/2/update-wiki-page/#update-wiki-page

func (*Client) UpdateWikiContext added in v0.5.0

func (c *Client) UpdateWikiContext(ctx context.Context, wiki *Wiki, mailNotify bool) (*Wiki, error)

UpdateWikiContext accepts context.

type OptionFunc added in v0.6.0

type OptionFunc func(*Client)

OptionFunc modifies API client.

func OptionHTTPClient added in v0.6.0

func OptionHTTPClient(client *http.Client) OptionFunc

OptionHTTPClient sets the given HTTP client.

Jump to

Keyboard shortcuts

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