v2

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	APIVersion     = "v2"
	ApiVersionPath = "api/" + APIVersion + "/"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AddIssueOptions

type AddIssueOptions struct {
	ParentIssueID          int                 `json:"parentIssueId,omitempty"`
	Description            string              `json:"description,omitempty"`
	StartDate              string              `json:"startDate,omitempty"`
	DueDate                string              `json:"dueDate,omitempty"`
	EstimatedHours         float64             `json:"estimatedHours,omitempty"`
	ActualHours            float64             `json:"actualHours,omitempty"`
	CategoryIDs            []int               `json:"categoryId[],omitempty"`
	VersionIDs             []int               `json:"versionId[],omitempty"`
	MilestoneIDs           []int               `json:"milestoneId[],omitempty"`
	AssigneeID             int                 `json:"assigneeId,omitempty"`
	NotifiedUserIDs        []int               `json:"notifiedUserId[],omitempty"`
	AttachmentIDs          []int               `json:"attachmentId[],omitempty"`
	CustomFields           map[int]interface{} `json:"customField_%v,omitempty"`
	CustomFieldOtherValues map[int]interface{} `json:"customField_%v_otherValue,omitempty"`
}

type AddPullRequestCommentOptions added in v0.10.0

type AddPullRequestCommentOptions struct {
	Content        string `json:"content"`
	NotifiedUserID []int  `json:"notifiedUserId[],omitempty"`
	AttachmentID   []int  `json:"attachmentId[],omitempty"`
}

type AddPullRequestOptions added in v0.9.5

type AddPullRequestOptions struct {
	Summary        string `json:"summary,omitempty"`
	Description    string `json:"description,omitempty"`
	Base           string `json:"base,omitempty"`
	Branch         string `json:"branch,omitempty"`
	IssueID        int    `json:"issueId,omitempty"`
	AssigneeID     int    `json:"assigneeId,omitempty"`
	NotifiedUserID []int  `json:"notifiedUserId,omitempty"`
	AttachmentID   []int  `json:"attachmentId,omitempty"`
}

type Assignee

type Assignee struct {
	ID          int         `json:"id"`
	UserID      string      `json:"userId"`
	Name        string      `json:"name"`
	RoleType    int         `json:"roleType"`
	Lang        interface{} `json:"lang"`
	MailAddress string      `json:"mailAddress"`
}

type Attachment

type Attachment struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
	Size int    `json:"size"`
}

type Category

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

type ChangeLog added in v0.10.0

type ChangeLog struct {
	Field         string      `json:"field"`
	NewValue      string      `json:"newValue"`
	OriginalValue interface{} `json:"originalValue"`
}

type Client

type Client struct {
	Space        *SpaceService
	Projects     *ProjectsService
	Issues       *IssuesService
	PullRequests *PullRequestsService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string, httpClient *http.Client) *Client

func (*Client) BaseURL added in v0.11.3

func (c *Client) BaseURL() *url.URL

func (*Client) SetAPIKey

func (c *Client) SetAPIKey(key string)

type CustomField

type CustomField struct {
	ID                   int                `json:"id"`
	TypeID               int                `json:"typeId"`
	Name                 string             `json:"name"`
	Description          string             `json:"description"`
	Required             bool               `json:"required"`
	ApplicableIssueTypes []int              `json:"applicableIssueTypes"`
	AllowAddItem         bool               `json:"allowAddItem"`
	Items                []*CustomFieldItem `json:"items"`
}

type CustomFieldItem

type CustomFieldItem struct {
	ID           int    `json:"id"`
	Name         string `json:"name"`
	DisplayOrder int    `json:"displayOrder"`
}

type DiskUsage added in v0.10.0

type DiskUsage struct {
	Capacity   int                `json:"capacity"`
	Issue      int                `json:"issue"`
	Wiki       int                `json:"wiki"`
	File       int                `json:"file"`
	Subversion int                `json:"subversion"`
	Git        int                `json:"git"`
	GitLFS     int                `json:"gitLFS"`
	Details    []*DiskUsageDetail `json:"details"`
}

type DiskUsageDetail added in v0.10.0

type DiskUsageDetail struct {
	ProjectID  int `json:"projectId"`
	Issue      int `json:"issue"`
	Wiki       int `json:"wiki"`
	File       int `json:"file"`
	Subversion int `json:"subversion"`
	Git        int `json:"git"`
	GitLFS     int `json:"gitLFS"`
}

type GetPullRequestCommentOptions added in v0.11.0

type GetPullRequestCommentOptions struct {
	MinID int   `json:"minId,omitempty"`
	MaxId int   `json:"maxId,omitempty"`
	Count int   `json:"count,omitempty"`
	Order Order `json:"order,omitempty"`
}

type Issue

type Issue struct {
	ID             int           `json:"id"`
	ProjectID      int           `json:"projectId"`
	IssueKey       string        `json:"issueKey"`
	KeyID          int           `json:"keyId"`
	IssueType      *IssueType    `json:"issueType"`
	Summary        string        `json:"summary"`
	Description    string        `json:"description"`
	Resolutions    *Resolution   `json:"resolutions"`
	Priority       *Priority     `json:"priority"`
	Status         *Status       `json:"status"`
	Assignee       *Assignee     `json:"assignee"`
	Category       []*Category   `json:"category"`
	Versions       []interface{} `json:"versions"`
	Milestone      []*Milestone  `json:"milestone"`
	StartDate      string        `json:"startDate"`
	DueDate        string        `json:"dueDate"`
	EstimatedHours float64       `json:"estimatedHours"`
	ActualHours    float64       `json:"actualHours"`
	ParentIssueID  *int          `json:"parentIssueId"`
	CreatedUser    *User         `json:"createdUser"`
	Created        *time.Time    `json:"created"`
	UpdatedUser    *User         `json:"updatedUser"`
	Updated        *time.Time    `json:"updated"`
	CustomFields   []interface{} `json:"customFields"`
	Attachments    []*Attachment `json:"attachments"`
	SharedFiles    []interface{} `json:"sharedFiles"`
	Stars          []*Star       `json:"stars"`
}

type IssueType

type IssueType struct {
	ID           int    `json:"id"`
	ProjectID    int    `json:"projectId"`
	Name         string `json:"name"`
	Color        string `json:"color"`
	DisplayOrder int    `json:"displayOrder"`
}

type IssuesService

type IssuesService service

func (*IssuesService) AddIssue

func (s *IssuesService) AddIssue(ctx context.Context, projectID int, summary string, issueTypeID, priorityID int, opt *AddIssueOptions) (*Issue, *shared.Response, error)

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

func (*IssuesService) GetIssue

func (s *IssuesService) GetIssue(ctx context.Context, issueIDOrKey string) (*Issue, *shared.Response, error)

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

type Milestone

type Milestone struct {
	ID             int    `json:"id"`
	ProjectID      int    `json:"projectId"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	StartDate      string `json:"startDate"`
	ReleaseDueDate string `json:"releaseDueDate"`
	Archived       bool   `json:"archived"`
	DisplayOrder   int    `json:"displayOrder"`
}

type NulabAccount

type NulabAccount struct {
	NulabID  string `json:"nulabId"`
	Name     string `json:"name"`
	UniqueID string `json:"uniqueId"`
}

type Order added in v0.11.0

type Order string
const (
	OrderAsc  Order = "asc"
	OrderDesc Order = "desc"
)

type Priority

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

type Project

type Project struct {
	ID                                int    `json:"id"`
	ProjectKey                        string `json:"projectKey"`
	Name                              string `json:"name"`
	ChartEnabled                      bool   `json:"chartEnabled"`
	SubtaskingEnabled                 bool   `json:"subtaskingEnabled"`
	ProjectLeaderCanEditProjectLeader bool   `json:"projectLeaderCanEditProjectLeader"`
	TextFormattingRule                string `json:"textFormattingRule"`
	Archived                          bool   `json:"archived"`
}

type ProjectsService

type ProjectsService service

func (*ProjectsService) GetCategories

func (s *ProjectsService) GetCategories(ctx context.Context, projectIDOrKey string) ([]*Category, *shared.Response, error)

GetCategories docs: https://developer.nulab-inc.com/docs/backlog/api/2/get-category-list/

func (*ProjectsService) GetCustomFields

func (s *ProjectsService) GetCustomFields(ctx context.Context, projectIDOrKey string) ([]*CustomField, *shared.Response, error)

GetCustomFields docs: https://developer.nulab-inc.com/docs/backlog/api/2/get-custom-field-list/

func (*ProjectsService) GetIssueTypes

func (s *ProjectsService) GetIssueTypes(ctx context.Context, projectIDOrKey string) ([]*IssueType, *shared.Response, error)

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

func (*ProjectsService) GetProject

func (s *ProjectsService) GetProject(ctx context.Context, projectIDOrKey string) (*Project, *shared.Response, error)

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

func (*ProjectsService) GetProjectUsers

func (s *ProjectsService) GetProjectUsers(ctx context.Context, projectIDOrKey string) ([]*User, *shared.Response, error)

GetProjectUsers docs: https://developer.nulab-inc.com/docs/backlog/api/2/get-project-user-list/ TODO apply excludeGroupMembers option

func (*ProjectsService) GetVersions

func (s *ProjectsService) GetVersions(ctx context.Context, projectIDOrKey string) ([]*Version, *shared.Response, error)

GetVersions docs: https://developer.nulab-inc.com/docs/backlog/api/2/get-version-milestone-list/

type PullRequest

type PullRequest struct {
	ID           int           `json:"id"`
	ProjectID    int           `json:"projectId"`
	RepositoryID int           `json:"repositoryId"`
	Number       int           `json:"number"`
	Summary      string        `json:"summary"`
	Description  string        `json:"description"`
	Base         string        `json:"base"`
	Branch       string        `json:"branch"`
	Status       Status        `json:"status"`
	Assignee     User          `json:"assignee"`
	Issue        Issue         `json:"issue"`
	BaseCommit   string        `json:"baseCommit"`
	BranchCommit string        `json:"branchCommit"`
	CloseAt      time.Time     `json:"closeAt"`
	MergeAt      time.Time     `json:"mergeAt"`
	CreatedUser  User          `json:"createdUser"`
	Created      time.Time     `json:"created"`
	UpdatedUser  User          `json:"updatedUser"`
	Updated      time.Time     `json:"updated"`
	Attachments  []*Attachment `json:"attachments"`
	Stars        []*Star       `json:"stars"`
}

type PullRequestComment added in v0.10.0

type PullRequestComment struct {
	ID            int           `json:"id"`
	Content       string        `json:"content"`
	ChangeLog     []*ChangeLog  `json:"changeLog"`
	CreatedUser   *User         `json:"createdUser"`
	Created       *time.Time    `json:"created"`
	Updated       *time.Time    `json:"updated"`
	Stars         []interface{} `json:"stars"`
	Notifications []interface{} `json:"notifications"`
}

type PullRequestsService

type PullRequestsService service

func (*PullRequestsService) AddPullRequest added in v0.9.5

func (s *PullRequestsService) AddPullRequest(ctx context.Context, projectIdOrKey, repoIdOrName string, opt *AddPullRequestOptions) (*PullRequest, *shared.Response, error)

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

func (*PullRequestsService) AddPullRequestComment added in v0.10.0

func (s *PullRequestsService) AddPullRequestComment(ctx context.Context, projectIdOrKey, repoIdOrName string, number int, opt *AddPullRequestCommentOptions) (*PullRequestComment, *shared.Response, error)

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

func (*PullRequestsService) GetPullRequest

func (s *PullRequestsService) GetPullRequest(ctx context.Context, projectIdOrKey, repoIdOrName string, number int) (*PullRequest, *shared.Response, error)

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

func (*PullRequestsService) GetPullRequestComment added in v0.11.0

func (s *PullRequestsService) GetPullRequestComment(ctx context.Context, projectIdOrKey, repoIdOrName string, number int, opt *GetPullRequestCommentOptions) ([]*PullRequestComment, *shared.Response, error)

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

func (*PullRequestsService) UpdatePullRequestComment added in v0.11.0

func (s *PullRequestsService) UpdatePullRequestComment(ctx context.Context, projectIdOrKey, repoIdOrName string, number, commentId int, opt *UpdatePullRequestCommentOptions) (*PullRequestComment, *shared.Response, error)

UpdatePullRequestComment docs: https://developer.nulab.com/docs/backlog/api/2/update-pull-request-comment-information/

type Resolution

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

type Space

type Space struct {
	SpaceKey           string    `json:"spaceKey"`
	Name               string    `json:"name"`
	OwnerID            int       `json:"ownerId"`
	Lang               string    `json:"lang"`
	Timezone           string    `json:"timezone"`
	ReportSendTime     string    `json:"reportSendTime"`
	TextFormattingRule string    `json:"textFormattingRule"`
	Created            time.Time `json:"created"`
	Updated            time.Time `json:"updated"`
}

type SpaceService

type SpaceService service

func (*SpaceService) GetSpaceDiskUsage added in v0.10.0

func (s *SpaceService) GetSpaceDiskUsage(ctx context.Context) (*DiskUsage, *shared.Response, error)

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

type Star

type Star struct {
	ID        int         `json:"id"`
	Comment   interface{} `json:"comment"`
	URL       string      `json:"url"`
	Title     string      `json:"title"`
	Presenter *User       `json:"presenter"`
	Created   *time.Time  `json:"created"`
}

type Status

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

type UpdatePullRequestCommentOptions added in v0.11.0

type UpdatePullRequestCommentOptions struct {
	Content string `json:"content"`
}

type User

type User struct {
	ID           int           `json:"id"`
	UserID       string        `json:"userId"`
	Name         string        `json:"name"`
	RoleType     int           `json:"roleType"`
	Lang         string        `json:"lang"`
	MailAddress  string        `json:"mailAddress"`
	NulabAccount *NulabAccount `json:"nulabAccount"`
}

type Version

type Version struct {
	ID             int    `json:"id"`
	ProjectID      int    `json:"projectId"`
	Name           string `json:"name"`
	Description    string `json:"description"`
	StartDate      string `json:"startDate"`
	ReleaseDueDate string `json:"releaseDueDate"`
	Archived       bool   `json:"archived"`
	DisplayOrder   int    `json:"displayOrder"`
}

Jump to

Keyboard shortcuts

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