backlog

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponse

func CheckResponse(r *http.Response) error

CheckResponse checks the API response for errors, and returns them if present.

Types

type Category

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

Category is Backlog category in the Backlog project

type ChangeLog

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

ChangeLog is Backlog issue comment

type Client

type Client struct {
	BaseURL *url.URL

	// Services
	Space    *SpaceService
	Projects *ProjectsService
	Issues   *IssuesService
	// contains filtered or unexported fields
}

A Client manages communication with the Backlog API.

func NewClient

func NewClient(httpClient *http.Client, space string, apiKey string) *Client

NewClient returns a new Backlog API client.

func (*Client) Do

func (c *Client) Do(req *http.Request, v interface{}) (*Response, error)

Do sends an API request and returns the API response.

func (*Client) NewRequest

func (c *Client) NewRequest(method, urlStr string, params *url.Values) (*http.Request, error)

NewRequest creates an API request.

type Error added in v0.2.0

type Error struct {
	Message  string `json:"message"`
	Code     int    `json:"code"`
	MoreInfo string `json:"moreInfo"`
}

An Error reports more details on an individual error in an ErrorResponse.

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response // HTTP response that caused this error
	Errors   []Error        `json:"errors"` // more detail on individual errors
}

An ErrorResponse reports one or more errors caused by an API request.

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

type Issue

type Issue struct {
	ID          int       `json:"id"`
	ProjectID   int       `json:"projectId"`
	IssueKey    string    `json:"issueKey"`
	KeyID       int       `json:"keyId"`
	Summary     string    `json:"summary"`
	Description string    `json:"description"`
	Priority    Priority  `json:"priority"`
	Title       string    `json:"title"`
	Created     time.Time `json:"created"`
	Updated     time.Time `json:"updated"`
	StartDate   time.Time `json:"startDate"`
	DueDate     time.Time `json:"dueDate"`

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

	Assignee struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"assignee"`

	CreatedUser struct {
		ID     int    `json:"id"`
		UserID string `json:"userId"`
		Name   string `json:"name"`
	} `json:"createdUser"`

	IssueType  IssueType  `json:"issueType"`
	Categories []Category `json:"category"`

	// Backlog の仕様では Version と Milestone は同じ型になる
	Versions   []Version `json:"versions"`
	Milestones []Version `json:"milestone"`
}

Issue is Backlog issue

type IssueComment

type IssueComment struct {
	ID      int       `json:"id"`
	Content string    `json:"content"`
	Created time.Time `json:"created"`
	Updated time.Time `json:"updated"`

	CreatedUser struct {
		ID     int    `json:"id"`
		UserID string `json:"userId"`
		Name   string `json:"name"`
	} `json:"createdUser"`

	ChangeLogs []ChangeLog `json:"changeLog"`
}

IssueComment is Backlog issue comment

type IssueRequest

type IssueRequest struct {
	Summary       *string
	Description   *string
	StatusID      *int
	ProjectID     *int
	PriorityID    *int
	CategoryID    *int
	IssueTypeID   *int
	AssigneeID    *int
	ParentIssueID *int
	VersionID     *int
	MilestoneID   *int
	StartDate     *string
	DueDate       *string
}

IssueRequest represents a request to create/edit an issue.

type IssueSearchRequest added in v0.4.0

type IssueSearchRequest struct {
	IDs            []int   `url:"id[],omitempty"`             // 課題のID
	ProjectIDs     []int   `url:"projectId[],omitempty"`      // プロジェクトのID
	StatusIDs      []int   `url:"statusId[],omitempty"`       // 状態のID
	PriorityIDs    []int   `url:"priorityId[],omitempty"`     // 優先度のID
	CategoryIDs    []int   `url:"categoryId[],omitempty"`     // カテゴリーのID
	VersionIDs     []int   `url:"versionId[],omitempty"`      // 課題の発生バージョンのID
	MilestoneIDs   []int   `url:"milestoneId[],omitempty"`    // 課題のマイルストーンのID
	IssueTypeIDs   []int   `url:"issueTypeId[],omitempty"`    // 種別のID
	AssigneeIDs    []int   `url:"assigneeId[],omitempty"`     // 担当者のID
	ParentIssueIDs []int   `url:"parentIssueId[],omitempty"`  // 親課題のID
	StartDateSince *string `url:"startDateSince[],omitempty"` // 開始日 (yyyy-MM-dd)
	DueDateSince   *string `url:"dueDateSince,omitempty"`     // 期限日 (yyyy-MM-dd)
	ParentChild    *int    `url:"parentChild,omitempty"`      // 親子課題の条件
	Sort           *string `url:"sort,omitempty"`             // 課題一覧のソートに使用する属性名
	Order          *string `url:"order,omitempty"`            // `asc` または `desc` 指定が無い場合は `desc`
	Keyword        *string `url:"keyword,omitempty"`          // 検索キーワード
	Count          *int    `url:"count,omitempty"`            // 取得上限 (1-100) 指定が無い場合は 20
	// contains filtered or unexported fields
}

IssueSearchRequest represents a request to create/edit an issue. https://developer.nulab-inc.com/ja/docs/backlog/api/2/get-issue-list/

type IssueType

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

IssueType is Backlog issueType in the Backlog project

type IssuesService

type IssuesService service

IssuesService is

func (*IssuesService) Create

func (s *IssuesService) Create(request IssueRequest) (*Issue, *Response, error)

Create creates an issue

func (*IssuesService) CreateComment

func (s *IssuesService) CreateComment(issueKey string, comment string) (*IssueComment, *Response, error)

CreateComment creates a new comment on the specified issue.

https://developer.nulab-inc.com/ja/docs/backlog/api/2/add-comment/

func (*IssuesService) Delete

func (s *IssuesService) Delete(issueKey string) (*Response, error)

Delete an issue

func (*IssuesService) Edit

func (s *IssuesService) Edit(issueKey string, request IssueRequest) (*Issue, *Response, error)

Edit an issue

func (*IssuesService) Get

func (s *IssuesService) Get(issueKey string) (*Issue, *Response, error)

Get an issue.

func (*IssuesService) ListComments

func (s *IssuesService) ListComments(issueKey string, order string) ([]*IssueComment, *Response, error)

ListComments lists all issue comments.

https://developer.nulab-inc.com/ja/docs/backlog/api/2/get-comment-list/ order: "asc" or "desc"

func (*IssuesService) Search added in v0.4.0

func (s *IssuesService) Search(request IssueSearchRequest) ([]*Issue, *Response, error)

Search issues.

type Priority

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

Priority is Backlog priority types in the Backlog space

type Project

type Project struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	ProjectKey string `json:"projectKey"`
}

Project is Backlog project in the Backlog space

type ProjectsService

type ProjectsService service

ProjectsService is

func (*ProjectsService) CreateCategory

func (s *ProjectsService) CreateCategory(projectKey string, categoryName string) (*Category, *Response, error)

CreateCategory creates a new category in the project.

func (*ProjectsService) CreateIssueType

func (s *ProjectsService) CreateIssueType(projectKey string, name string, color string) (*IssueType, *Response, error)

CreateIssueType creates a new category in the project.

func (*ProjectsService) DeleteCategory

func (s *ProjectsService) DeleteCategory(projectKey string, categoryID string) (*Response, error)

DeleteCategory deletes a category in the project.

func (*ProjectsService) DeleteIssueType

func (s *ProjectsService) DeleteIssueType(projectKey string, issueTypeID string, substituteIssueTypeID string) (*Response, error)

DeleteIssueType deletes a category in the project.

substituteIssueTypeID: 付け替え先の種別 ID。Backlog の仕様上、最低 1 個の種別を残す必要あり。

func (*ProjectsService) ListAll

func (s *ProjectsService) ListAll() ([]*Project, *Response, error)

ListAll lists all projects.

func (*ProjectsService) ListCategories

func (s *ProjectsService) ListCategories(projectKey string) ([]*Category, *Response, error)

ListCategories lists all issueTypes.

func (*ProjectsService) ListIssueTypes

func (s *ProjectsService) ListIssueTypes(projectKey string) ([]*IssueType, *Response, error)

ListIssueTypes lists all issueTypes.

func (*ProjectsService) ListUsers

func (s *ProjectsService) ListUsers(projectKey string) ([]*User, *Response, error)

ListUsers lists all users in the project.

func (*ProjectsService) ListVersions added in v0.5.0

func (s *ProjectsService) ListVersions(projectKey string) ([]*Version, *Response, error)

ListVersions lists all versions (milestones).

type Resolution added in v0.3.0

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

Resolution is Backlog resolution types in the Backlog space

type Response

type Response struct {
	*http.Response
}

Response is a Backlog API response.

type SpaceService

type SpaceService service

SpaceService is

func (*SpaceService) ListPriorities

func (s *SpaceService) ListPriorities() ([]*Priority, *Response, error)

ListPriorities lists all priorities.

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

func (*SpaceService) ListResolutions added in v0.3.0

func (s *SpaceService) ListResolutions() ([]*Resolution, *Response, error)

ListResolutions lists all resolutions.

https://developer.nulab-inc.com/ja/docs/backlog/api/2/get-resolution-list/

func (*SpaceService) ListStatuses added in v0.3.0

func (s *SpaceService) ListStatuses() ([]*Status, *Response, error)

ListStatuses lists all statuses.

https://developer.nulab-inc.com/ja/docs/backlog/api/2/get-status-list/

type Status added in v0.3.0

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

Status is Backlog status types in the Backlog space

type User

type User struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	UserID string `json:"userId"`
}

User is Backlog user

type Version added in v0.5.0

type Version struct {
	ID             int       `json:"id"`
	Name           string    `json:"name"`
	ProjectKey     string    `json:"projectKey"`
	Description    string    `json:"description"`
	StartDate      time.Time `json:"startDate"`
	ReleaseDueDate time.Time `json:"releaseDueDate"`
	Archived       bool      `json:"archived"`
}

Version is Backlog version (mileston) in the Backlog project

Jump to

Keyboard shortcuts

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