backlog

package module
v0.0.0-...-563505a Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2021 License: MIT Imports: 12 Imported by: 12

README

go-backlog

GoDoc Go Report Card Test codecov

Go client library for Nulab Backlog API

Feature

  • You can request each API endpoint using the Backlog API client created from the API base URL and token.
  • Converts API response to a corresponding structure.
  • Structures are provided for all endpoints and responses.

Requirements

  • Go >= 1.14

Installation

go get github.com/nattokin/go-backlog

Examples

Get a wiki
package main

import (
	"fmt"
	"log"

	"github.com/nattokin/go-backlog"
)

func main() {
	// The base URL of Backlog API.
	baseURL := "BACKLOG_BASE_URL"
	// The tokun for request to Backlog API.
	token := "BACKLOG_TOKEN"

	// Create Backlog API client.
	c, err := backlog.NewClient(baseURL, token)
	if err != nil {
		log.Fatalln(err)
	}

	r, err := c.Wiki.One(12345)
	if err != nil {
		log.Fatalln(err)
	}
	fmt.Printf("%#v\n", r)
}
Get wikis list in the project
package main

import (
	"fmt"
	"log"

	"github.com/nattokin/go-backlog"
)

func main() {
	// The base URL of Backlog API.
	baseURL := "BACKLOG_BASE_URL"
	// The tokun for request to Backlog API.
	token := "BACKLOG_TOKEN"
	// Create Backlog API client.
	c, err := backlog.NewClient(baseURL, token)
	if err != nil {
		log.Fatalln(err)
	}
	// ID or Key of the project.
	projectKey := "PROJECTKEY"
	r, err := c.Wiki.All(projectKey)
	// projectID := "1234"
	// r, err := c.Wiki.All(projectID)

	if err != nil {
		log.Fatalln(err)
	}
	for _, w := range r {
		fmt.Printf("%#v\n", w)
	}
}

Supported API endpoints

Client.Space.Activity
Client.Space.Attachment
  • Post Attachment File - Posts an attachment file for issue or wiki. Returns id of the attachment file.
Client.User
  • Get User List - Returns list of users in your space.
  • Get User - Returns information about user.
  • Add User - Adds new user to the space. “Project Administrator” cannot add “Admin” user. You can’t use this API at backlog.com space.
  • Update User - Updates information about user. You can’t use this API at backlog.com space.
  • Delete User - Deletes user from the space. You can’t use this API at backlog.com space.
  • Get Own User - Returns own information about user.
Client.User.Activity
Client.Project
Client.Project.Activity
Client.Project.User
Client.Wiki
Client.Wiki.Attachment

License

The license of this project is MIT license.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponseError

type APIResponseError struct {
	Errors []*Error `json:"errors,omitempty"`
}

APIResponseError represents Error Response of Backlog API.

func (*APIResponseError) Error

func (e *APIResponseError) Error() string

All error massages converted to APIResponseError is returned.

type Activity

type Activity struct {
	ID            int              `json:"id,omitempty"`
	Project       *Project         `json:"project,omitempty"`
	Type          int              `json:"type,omitempty"`
	Content       *ActivityContent `json:"content,omitempty"`
	Notifications []*Notification  `json:"notifications,omitempty"`
	CreatedUser   *User            `json:"createdUser,omitempty"`
}

Activity represents a activity.

type ActivityContent

type ActivityContent struct {
	ID          int      `json:"id,omitempty"`
	KeyID       int      `json:"key_id,omitempty"`
	Summary     string   `json:"summary,omitempty"`
	Description string   `json:"description,omitempty"`
	Comment     *Comment `json:"comment,omitempty"`
}

ActivityContent represents content of Activity.

type ActivityOptionService

type ActivityOptionService struct {
}

ActivityOptionService has methods to make option for ActivityService.

func (*ActivityOptionService) WithQueryActivityTypeIDs

func (*ActivityOptionService) WithQueryActivityTypeIDs(typeIDs []int) *QueryOption

WithQueryActivityTypeIDs returns option to set `activityTypeId` for user.

func (*ActivityOptionService) WithQueryCount

func (*ActivityOptionService) WithQueryCount(count int) *QueryOption

WithQueryCount returns option to set `count` for user.

func (*ActivityOptionService) WithQueryMaxID

func (*ActivityOptionService) WithQueryMaxID(maxID int) *QueryOption

WithQueryMaxID returns option to set `maxId` for user.

func (*ActivityOptionService) WithQueryMinID

func (*ActivityOptionService) WithQueryMinID(minID int) *QueryOption

WithQueryMinID returns option to set `minId` for user.

func (*ActivityOptionService) WithQueryOrder

func (*ActivityOptionService) WithQueryOrder(order Order) *QueryOption

WithQueryOrder returns option to set `order` for user.

type Attachment

type Attachment struct {
	ID          int       `json:"id,omitempty"`
	Name        string    `json:"name,omitempty"`
	Size        int       `json:"size,omitempty"`
	CreatedUser *User     `json:"createdUser,omitempty"`
	Created     time.Time `json:"created,omitempty"`
}

Attachment represents a attachment.

type Category

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

Category represents a category.

type CategoryService

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

CategoryService has methods for Category.

type ChangeLog

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

ChangeLog reprements the changelog.

type Client

type Client struct {
	Issue       *IssueService
	Project     *ProjectService
	PullRequest *PullRequestService
	Space       *SpaceService
	User        *UserService
	Wiki        *WikiService
	// contains filtered or unexported fields
}

Client is Backlog API client.

func NewClient

func NewClient(baseURL, token string) (*Client, error)

NewClient creates a new Backlog API Client.

type ClinetError

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

ClinetError is a description of a Backlog API client error.

func (*ClinetError) Error

func (e *ClinetError) Error() string

type Comment

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

Comment reprements any one comment.

type CustomField

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

CustomField represents a custom field.

type CustomFieldItem

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

CustomFieldItem represents one of Items in CustomField.

type CustomFieldService

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

CustomFieldService has methods for CustomField.

type DiskUsageBase

type DiskUsageBase struct {
	Issue      int `json:"issue,omitempty"`
	Wiki       int `json:"wiki,omitempty"`
	File       int `json:"file,omitempty"`
	Subversion int `json:"subversion,omitempty"`
	Git        int `json:"git,omitempty"`
	GitLFS     int `json:"gitLFS,omitempty"`
}

DiskUsageBase represents base of disk usage.

type DiskUsageProject

type DiskUsageProject struct {
	DiskUsageBase
	ProjectID int `json:"projectId,omitempty"`
}

DiskUsageProject represents project's disk usage.

type DiskUsageSpace

type DiskUsageSpace struct {
	DiskUsageBase
	Capacity int                 `json:"capacity,omitempty"`
	Details  []*DiskUsageProject `json:"details,omitempty"`
}

DiskUsageSpace represents space's disk usage.

type Error

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

Error represents one of Backlog API response errors.

func (*Error) Error

func (e *Error) Error() string

Error message converted from API error is returned.

type FormOption

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

FormOption is option to set form parameter for request.

type FormParams

type FormParams struct {
	*url.Values
}

FormParams wraps url.Values.

func NewFormParams

func NewFormParams() *FormParams

NewFormParams returns new FormParams.

func (*FormParams) NewReader

func (p *FormParams) NewReader() io.Reader

NewReader converts FormParams to io.Reader.

type Format

type Format string

Format of Backlog wiki.

const (
	FormatMarkdown Format = "markdown"
	FormatBacklog  Format = "backlog"
)

Fomat of Backlog wiki

func (Format) String

func (f Format) String() string

type InvalidFormOptionError

type InvalidFormOptionError struct {
	Invalid   formType
	ValidList []formType
}

InvalidFormOptionError is an invalid option error.

func (*InvalidFormOptionError) Error

func (e *InvalidFormOptionError) Error() string

type InvalidQueryOptionError

type InvalidQueryOptionError struct {
	Invalid   queryType
	ValidList []queryType
}

InvalidQueryOptionError is an invalid option error.

func (*InvalidQueryOptionError) Error

func (e *InvalidQueryOptionError) Error() string

type Issue

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

Issue represents a issue of Backlog.

type IssueAttachmentService

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

IssueAttachmentService hs methods for attachment file of issue.

func (*IssueAttachmentService) List

func (s *IssueAttachmentService) List(issueIDOrKey string) ([]*Attachment, error)

List returns a list of all attachments in the issue.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-list-of-issue-attachments

func (*IssueAttachmentService) Remove

func (s *IssueAttachmentService) Remove(issueIDOrKey string, attachmentID int) (*Attachment, error)

Remove removes a file attached to the issue.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/delete-issue-attachment

type IssueService

type IssueService struct {
	Attachment *IssueAttachmentService
	// contains filtered or unexported fields
}

IssueService has methods for Issue.

type IssueType

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

IssueType represents type of Issue.

type Licence

type Licence struct {
	Active                            bool      `json:"active,omitempty"`
	AttachmentLimit                   int       `json:"attachmentLimit,omitempty"`
	AttachmentLimitPerFile            int       `json:"attachmentLimitPerFile,omitempty"`
	AttachmentNumLimit                int       `json:"attachmentNumLimit,omitempty"`
	Attribute                         bool      `json:"attribute,omitempty"`
	AttributeLimit                    int       `json:"attributeLimit,omitempty"`
	Burndown                          bool      `json:"burndown,omitempty"`
	CommentLimit                      int       `json:"commentLimit,omitempty"`
	ComponentLimit                    int       `json:"componentLimit,omitempty"`
	FileSharing                       bool      `json:"fileSharing,omitempty"`
	Gantt                             bool      `json:"gantt,omitempty"`
	Git                               bool      `json:"git,omitempty"`
	IssueLimit                        int       `json:"issueLimit,omitempty"`
	LicenceTypeID                     int       `json:"licenceTypeId,omitempty"`
	LimitDate                         time.Time `json:"limitDate,omitempty"`
	NulabAccount                      bool      `json:"nulabAccount,omitempty"`
	ParentChildIssue                  bool      `json:"parentChildIssue,omitempty"`
	PostIssueByMail                   bool      `json:"postIssueByMail,omitempty"`
	ProjectGroup                      bool      `json:"projectGroup,omitempty"`
	ProjectLimit                      int       `json:"projectLimit,omitempty"`
	PullRequestAttachmentLimitPerFile int       `json:"pullRequestAttachmentLimitPerFile,omitempty"`
	PullRequestAttachmentNumLimit     int       `json:"pullRequestAttachmentNumLimit,omitempty"`
	RemoteAddress                     bool      `json:"remoteAddress,omitempty"`
	RemoteAddressLimit                int       `json:"remoteAddressLimit,omitempty"`
	StartedOn                         time.Time `json:"startedOn,omitempty"`
	StorageLimit                      int64     `json:"storageLimit,omitempty"`
	Subversion                        bool      `json:"subversion,omitempty"`
	SubversionExternal                bool      `json:"subversionExternal,omitempty"`
	UserLimit                         int       `json:"userLimit,omitempty"`
	VersionLimit                      int       `json:"versionLimit,omitempty"`
	WikiAttachment                    bool      `json:"wikiAttachment,omitempty"`
	WikiAttachmentLimitPerFile        int       `json:"wikiAttachmentLimitPerFile,omitempty"`
	WikiAttachmentNumLimit            int       `json:"wikiAttachmentNumLimit,omitempty"`
}

Licence represents licence.

type Notification

type Notification struct {
	ID                  int          `json:"id,omitempty"`
	AlreadyRead         bool         `json:"alreadyRead,omitempty"`
	Reason              int          `json:"reason,omitempty"`
	ResourceAlreadyRead bool         `json:"resourceAlreadyRead,omitempty"`
	Project             *Project     `json:"project,omitempty"`
	Issue               *Issue       `json:"issue,omitempty"`
	Comment             *Comment     `json:"comment,omitempty"`
	PullRequest         *PullRequest `json:"pullRequest,omitempty"`
	PullRequestComment  *Comment     `json:"pullRequestComment,omitempty"`
	Sender              *User        `json:"sender,omitempty"`
	Created             time.Time    `json:"created,omitempty"`
}

Notification represents some notification.

type Order

type Order string

Order type.

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

Order type

func (Order) String

func (o Order) String() string

type Priority

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

Priority represents a priority.

type PriorityService

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

PriorityService has methods for Priority.

type Project

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

Project represents a project of Backlog.

type ProjectActivityService

type ProjectActivityService struct {
	Option *ActivityOptionService
	// contains filtered or unexported fields
}

ProjectActivityService has methods for activitys of the project.

func (*ProjectActivityService) List

func (s *ProjectActivityService) List(projectIDOrKey string, options ...*QueryOption) ([]*Activity, error)

List returns a list of activities in the project.

This method can specify the options returned by methods in "*Client.Project.Activity.Option".

Use the following methods:

WithQueryActivityTypeIDs
WithQueryMinID
WithQueryMaxID
WithQueryCount
WithQueryOrder

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-project-recent-updates

type ProjectOptionService

type ProjectOptionService struct {
}

ProjectOptionService has methods to make option for ProjectService.

func (*ProjectOptionService) WithFormArchived

func (*ProjectOptionService) WithFormArchived(archived bool) *FormOption

WithFormArchived returns option to set `archived` for project.

func (*ProjectOptionService) WithFormChartEnabled

func (*ProjectOptionService) WithFormChartEnabled(enabeld bool) *FormOption

WithFormChartEnabled returns option to set `chartEnabled` for project.

func (*ProjectOptionService) WithFormKey

func (*ProjectOptionService) WithFormKey(key string) *FormOption

WithFormKey returns option to set `key` for project.

func (*ProjectOptionService) WithFormName

func (*ProjectOptionService) WithFormName(name string) *FormOption

WithFormName returns option to set `name` for project.

func (*ProjectOptionService) WithFormProjectLeaderCanEditProjectLeader

func (*ProjectOptionService) WithFormProjectLeaderCanEditProjectLeader(enabeld bool) *FormOption

WithFormProjectLeaderCanEditProjectLeader returns option to set `projectLeaderCanEditProjectLeader` for project.

func (*ProjectOptionService) WithFormSubtaskingEnabled

func (*ProjectOptionService) WithFormSubtaskingEnabled(enabeld bool) *FormOption

WithFormSubtaskingEnabled returns option to set `subtaskingEnabled` for project.

func (*ProjectOptionService) WithFormTextFormattingRule

func (*ProjectOptionService) WithFormTextFormattingRule(format Format) *FormOption

WithFormTextFormattingRule returns option to set `textFormattingRule` for project.

func (*ProjectOptionService) WithQueryAll

func (*ProjectOptionService) WithQueryAll(enabeld bool) *QueryOption

WithQueryAll returns option to set `all` for query parameter.

func (*ProjectOptionService) WithQueryArchived

func (*ProjectOptionService) WithQueryArchived(archived bool) *QueryOption

WithQueryArchived returns option to set `archived` for query parameter.

type ProjectService

type ProjectService struct {
	Activity *ProjectActivityService
	User     *ProjectUserService
	Option   *ProjectOptionService
	// contains filtered or unexported fields
}

ProjectService has methods for Project.

func (*ProjectService) AdminAll

func (s *ProjectService) AdminAll(options ...*QueryOption) ([]*Project, error)

AdminAll returns all of projects. This is limited to admin. If you are not an admin, only joining projects returned.

This method can specify the options returned by methods in "*Client.Project.Option".

Use the following methods:

WithQueryArchived

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

func (*ProjectService) AdminAllArchived

func (s *ProjectService) AdminAllArchived() ([]*Project, error)

AdminAllArchived returns all of projects archived. If you are not an admin, only joining projects returned.

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

func (*ProjectService) AdminAllUnarchived

func (s *ProjectService) AdminAllUnarchived() ([]*Project, error)

AdminAllUnarchived returns all of projects unarchived. If you are not an admin, only joining projects returned.

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

func (*ProjectService) All

func (s *ProjectService) All(options ...*QueryOption) ([]*Project, error)

All returns all of projects.

This method can specify the options returned by methods in "*Client.Project.Option".

Use the following methods:

WithQueryAll
WithQueryArchived

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

func (*ProjectService) AllArchived

func (s *ProjectService) AllArchived() ([]*Project, error)

AllArchived returns all of joining projects archived. If you are not an admin, only joining projects returned.

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

func (*ProjectService) AllUnarchived

func (s *ProjectService) AllUnarchived() ([]*Project, error)

AllUnarchived returns all of joining projects unarchived. If you are not an admin, only joining projects returned.

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

func (*ProjectService) Create

func (s *ProjectService) Create(key, name string, options ...*FormOption) (*Project, error)

Create creates a new project.

This method can specify the options returned by methods in "*Client.Project.Option".

Use the following methods:

WithFormChartEnabled
WithFormSubtaskingEnabled
WithFormProjectLeaderCanEditProjectLeader
WithFormTextFormattingRule

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/add-project

func (*ProjectService) Delete

func (s *ProjectService) Delete(projectIDOrKey string) (*Project, error)

Delete deletes a project.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/delete-project

func (*ProjectService) One

func (s *ProjectService) One(projectIDOrKey string) (*Project, error)

One returns one of the projects searched by ID or key.

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

func (*ProjectService) Update

func (s *ProjectService) Update(projectIDOrKey string, options ...*FormOption) (*Project, error)

Update updates a project.

This method can specify the options returned by methods in "*Client.Project.Option".

Use the following methods:

WithFormKey
WithFormName
WithFormChartEnabled
WithFormSubtaskingEnabled
WithFormProjectLeaderCanEditProjectLeader
WithFormTextFormattingRule
WithFormArchived
WithFormTextFormattingRule

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/update-project

type ProjectUserService

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

ProjectUserService has methods for user of project.

func (*ProjectUserService) Add

func (s *ProjectUserService) Add(projectIDOrKey string, userID int) (*User, error)

Add adds a user to the project.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/add-project-user

func (*ProjectUserService) AddAdmin

func (s *ProjectUserService) AddAdmin(projectIDOrKey string, userID int) (*User, error)

AddAdmin adds a admin user to the project.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/add-project-administrator

func (*ProjectUserService) AdminAll

func (s *ProjectUserService) AdminAll(projectIDOrKey string) ([]*User, error)

AdminAll returns all of admin users in the project.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-list-of-project-administrators

func (*ProjectUserService) All

func (s *ProjectUserService) All(projectIDOrKey string, excludeGroupMembers bool) ([]*User, error)

All returns all users in the project.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-project-user-list

func (*ProjectUserService) Delete

func (s *ProjectUserService) Delete(projectIDOrKey string, userID int) (*User, error)

Delete deletes a user from the project.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/delete-project-user

func (*ProjectUserService) DeleteAdmin

func (s *ProjectUserService) DeleteAdmin(projectIDOrKey string, userID int) (*User, error)

DeleteAdmin deletes a admin user from the project.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/delete-project-administrator

type PullRequest

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

PullRequest represents pull request of Backlog git.

type PullRequestAttachmentService

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

PullRequestAttachmentService hs methods for attachment file of pull request.

func (*PullRequestAttachmentService) List

func (s *PullRequestAttachmentService) List(projectIDOrKey string, repositoryIDOrName string, prNumber int) ([]*Attachment, error)

List returns a list of all attachments in the pull request.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-list-of-pull-request-attachment

func (*PullRequestAttachmentService) Remove

func (s *PullRequestAttachmentService) Remove(projectIDOrKey string, repositoryIDOrName string, prNumber int, attachmentID int) (*Attachment, error)

Remove removes a file attached to the pull request.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/delete-pull-request-attachments

type PullRequestService

type PullRequestService struct {
	Attachment *PullRequestAttachmentService
	// contains filtered or unexported fields
}

PullRequestService has methods for Issue.

type QueryOption

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

QueryOption is option of request query.

type QueryOptionService

type QueryOptionService struct {
}

QueryOptionService has methods to make option for request query.

func (*QueryOptionService) WithActivityTypeIDs

func (s *QueryOptionService) WithActivityTypeIDs(typeIDs []int) *QueryOption

WithActivityTypeIDs returns option to set `activityTypeId`.

func (*QueryOptionService) WithAll

func (s *QueryOptionService) WithAll(enabeld bool) *QueryOption

WithAll returns option to set `all`.

func (*QueryOptionService) WithArchived

func (s *QueryOptionService) WithArchived(archived bool) *QueryOption

WithArchived returns option to set `archived`.

func (*QueryOptionService) WithCount

func (s *QueryOptionService) WithCount(count int) *QueryOption

WithCount returns option to set `count`.

func (*QueryOptionService) WithKeyword

func (s *QueryOptionService) WithKeyword(keyword string) *QueryOption

WithKeyword returns option to set `keyword`.

func (*QueryOptionService) WithMaxID

func (s *QueryOptionService) WithMaxID(maxID int) *QueryOption

WithMaxID returns option to set `maxId`.

func (*QueryOptionService) WithMinID

func (s *QueryOptionService) WithMinID(minID int) *QueryOption

WithMinID returns option to set `minId`.

func (*QueryOptionService) WithOrder

func (s *QueryOptionService) WithOrder(order Order) *QueryOption

WithOrder returns option to set `order`.

type QueryParams

type QueryParams struct {
	*url.Values
}

QueryParams is query parameters for request.

func NewQueryParams

func NewQueryParams() *QueryParams

NewQueryParams returns new QueryParams.

type Repository

type Repository struct {
	ID           int       `json:"id,omitempty"`
	ProjectID    int       `json:"projectId,omitempty"`
	Name         string    `json:"name,omitempty"`
	Description  string    `json:"description,omitempty"`
	HookURL      string    `json:"hookUrl,omitempty"`
	HTTPURL      string    `json:"httpUrl,omitempty"`
	SSHURL       string    `json:"sshUrl,omitempty"`
	DisplayOrder int       `json:"displayOrder,omitempty"`
	PushedAt     time.Time `json:"pushedAt,omitempty"`
	CreatedUser  *User     `json:"createdUser,omitempty"`
	Created      time.Time `json:"created,omitempty"`
	UpdatedUser  *User     `json:"updatedUser,omitempty"`
	Updated      time.Time `json:"updated,omitempty"`
}

Repository represents repository of Backlog git.

type RepositoryService

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

RepositoryService has methods for Repository.

type Resolution

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

Resolution represents a resolushon.

type ResolutionService

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

ResolutionService has methods for Resolution.

type Role

type Role int

Role type.

const (
	RoleAdministrator Role
	RoleNormalUser
	RoleReporter
	RoleViewer
	RoleGuestReporter
	RoleGuestViewer
)

Role type

func (Role) String

func (r Role) String() string

type SharedFile

type SharedFile struct {
	ID          int       `json:"id,omitempty"`
	Type        string    `json:"type,omitempty"`
	Dir         string    `json:"dir,omitempty"`
	Name        string    `json:"name,omitempty"`
	Size        int       `json:"size,omitempty"`
	CreatedUser *User     `json:"createdUser,omitempty"`
	Created     time.Time `json:"created,omitempty"`
	UpdatedUser *User     `json:"updatedUser,omitempty"`
	Updated     time.Time `json:"updated,omitempty"`
}

SharedFile represents a shared file.

type Space

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

Space represents space of Backlog.

type SpaceActivityService

type SpaceActivityService struct {
	Option *ActivityOptionService
	// contains filtered or unexported fields
}

SpaceActivityService has methods for activitys in your space.

func (*SpaceActivityService) List

func (s *SpaceActivityService) List(options ...*QueryOption) ([]*Activity, error)

List returns a list of activities in your space.

This method can specify the options returned by methods in "*Client.Space.Activity.Option".

Use the following methods:

WithQueryActivityTypeIDs
WithQueryMinID
WithQueryMaxID
WithQueryCount
WithQueryOrder

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-recent-updates

type SpaceAttachmentService

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

SpaceAttachmentService hs methods for attachment.

func (*SpaceAttachmentService) Upload

func (s *SpaceAttachmentService) Upload(fileName string, r io.Reader) (*Attachment, error)

Upload uploads a any file to the space.

File's path and name are must not empty.

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

type SpaceNotification

type SpaceNotification struct {
	Content string    `json:"content,omitempty"`
	Updated time.Time `json:"updated,omitempty"`
}

SpaceNotification represents a notification of Space.

type SpaceService

type SpaceService struct {
	Activity   *SpaceActivityService
	Attachment *SpaceAttachmentService
	// contains filtered or unexported fields
}

SpaceService has methods for Space.

type Star

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

Star represents any Star.

type Status

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

Status represents any status.

type StatusService

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

StatusService has methods for Status.

type Tag

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

Tag represents one of tags in Wiki.

type Team

type Team struct {
	ID           int       `json:"id,omitempty"`
	Name         string    `json:"name,omitempty"`
	Members      []*User   `json:"members,omitempty"`
	DisplayOrder int       `json:"displayOrder,omitempty"`
	CreatedUser  *User     `json:"createdUser,omitempty"`
	Created      time.Time `json:"created,omitempty"`
	UpdatedUser  *User     `json:"updatedUser,omitempty"`
	Updated      time.Time `json:"updated,omitempty"`
}

Team represents team.

type User

type User struct {
	ID          int    `json:"id,omitempty"`
	UserID      string `json:"userId,omitempty"`
	Name        string `json:"name,omitempty"`
	RoleType    Role   `json:"roleType,omitempty"`
	Lang        string `json:"lang,omitempty"`
	MailAddress string `json:"mailAddress,omitempty"`
}

User represents user.

type UserActivityService

type UserActivityService struct {
	Option *ActivityOptionService
	// contains filtered or unexported fields
}

UserActivityService has methods for user activitys.

func (*UserActivityService) List

func (s *UserActivityService) List(userID int, options ...*QueryOption) ([]*Activity, error)

List returns a list of user activities.

This method can specify the options returned by methods in "*Client.User.Activity.Option".

Use the following methods:

WithQueryActivityTypeIDs
WithQueryMinID
WithQueryMaxID
WithQueryCount
WithQueryOrder

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-user-recent-updates

type UserID

type UserID int

UserID is ID of user.

func (UserID) String

func (id UserID) String() string

type UserOptionService

type UserOptionService struct {
}

UserOptionService has methods to make option for UserService.

func (*UserOptionService) WithFormMailAddress

func (*UserOptionService) WithFormMailAddress(mailAddress string) *FormOption

WithFormMailAddress returns option to set `mailAddress` for user.

func (*UserOptionService) WithFormName

func (*UserOptionService) WithFormName(name string) *FormOption

WithFormName returns option to set `password` for user.

func (*UserOptionService) WithFormPassword

func (*UserOptionService) WithFormPassword(password string) *FormOption

WithFormPassword returns option to set `password` for user.

func (*UserOptionService) WithFormRoleType

func (*UserOptionService) WithFormRoleType(roleType Role) *FormOption

WithFormRoleType returns option to set `roleType` for user.

type UserService

type UserService struct {
	Activity *UserActivityService
	Option   *UserOptionService
	// contains filtered or unexported fields
}

UserService has methods for user

func (*UserService) Add

func (s *UserService) Add(userID, password, name, mailAddress string, roleType Role) (*User, error)

Add adds a user to your space.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/add-user

func (*UserService) All

func (s *UserService) All() ([]*User, error)

All returns all users in your space.

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

func (*UserService) Delete

func (s *UserService) Delete(id int) (*User, error)

Delete deletes a user from your space.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/delete-user

func (*UserService) One

func (s *UserService) One(id int) (*User, error)

One returns a user in your space.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-user

func (*UserService) Own

func (s *UserService) Own() (*User, error)

Own returns your own user.

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

func (*UserService) Update

func (s *UserService) Update(id int, options ...*FormOption) (*User, error)

Update updates a user in your space.

This method can specify the options returned by methods in "*Client.User.Option".

Use the following methods:

WithFormName
WithFormPassword
WithFormMailAddress
WithFormRoleType

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/update-user

type ValidationError

type ValidationError struct {
	Message string
}

ValidationError represents an argument validation error.

func (*ValidationError) Error

func (e *ValidationError) Error() string

type Version

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

Version represents any version.

type VersionService

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

VersionService has methods for Version.

type WatchingItem

type WatchingItem struct {
	ID                  int       `json:"id,omitempty"`
	ResourceAlreadyRead bool      `json:"resourceAlreadyRead,omitempty"`
	Note                string    `json:"note,omitempty"`
	Type                string    `json:"type,omitempty"`
	Issue               *Issue    `json:"issue,omitempty"`
	LastContentUpdated  time.Time `json:"lastContentUpdated,omitempty"`
	Created             time.Time `json:"created,omitempty"`
	Updated             time.Time `json:"updated,omitempty"`
}

WatchingItem represents an item of watching list.

type Webhook

type Webhook struct {
	ID              int       `json:"id,omitempty"`
	Name            string    `json:"name,omitempty"`
	Description     string    `json:"description,omitempty"`
	HookURL         string    `json:"hookUrl,omitempty"`
	AllEvent        bool      `json:"allEvent,omitempty"`
	ActivityTypeIds []int     `json:"activityTypeIds,omitempty"`
	CreatedUser     *User     `json:"createdUser,omitempty"`
	Created         time.Time `json:"created,omitempty"`
	UpdatedUser     *User     `json:"updatedUser,omitempty"`
	Updated         time.Time `json:"updated,omitempty"`
}

Webhook represents webhook of Backlog.

type Wiki

type Wiki struct {
	ID          int           `json:"id,omitempty"`
	ProjectID   int           `json:"projectId,omitempty"`
	Name        string        `json:"name,omitempty"`
	Content     string        `json:"content,omitempty"`
	Tags        []*Tag        `json:"tags,omitempty"`
	Attachments []*Attachment `json:"attachments,omitempty"`
	SharedFiles []*SharedFile `json:"sharedFiles,omitempty"`
	Stars       []*Star       `json:"stars,omitempty"`
	CreatedUser *User         `json:"createdUser,omitempty"`
	Created     time.Time     `json:"created,omitempty"`
	UpdatedUser *User         `json:"updatedUser,omitempty"`
	Updated     time.Time     `json:"updated,omitempty"`
}

Wiki represents Backlog Wiki.

type WikiAttachmentService

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

WikiAttachmentService hs methods for attachment file of wiki.

func (*WikiAttachmentService) Attach

func (s *WikiAttachmentService) Attach(wikiID int, attachmentIDs []int) ([]*Attachment, error)

Attach attachs files uploaded to space to the wiki.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/attach-file-to-wiki

func (*WikiAttachmentService) List

func (s *WikiAttachmentService) List(wikiID int) ([]*Attachment, error)

List returns a list of all attachments in the wiki.

Backlog API docs: https://developer.nulab.com/docs/backlog/api/2/get-list-of-wiki-attachments

func (*WikiAttachmentService) Remove

func (s *WikiAttachmentService) Remove(wikiID, attachmentID int) (*Attachment, error)

Remove removes a file attached to the wiki.

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

type WikiHistory

type WikiHistory struct {
	PageID      int       `json:"pageId,omitempty"`
	Version     int       `json:"version,omitempty"`
	Name        string    `json:"name,omitempty"`
	Content     string    `json:"content,omitempty"`
	CreatedUser *User     `json:"createdUser,omitempty"`
	Created     time.Time `json:"created,omitempty"`
}

WikiHistory reprements history of Wiki.

type WikiOptionService

type WikiOptionService struct {
}

WikiOptionService has methods to make option for WikiService.

func (*WikiOptionService) WithFormContent

func (*WikiOptionService) WithFormContent(content string) *FormOption

WithFormContent returns option to set `content` for wiki.

func (*WikiOptionService) WithFormMailNotify

func (*WikiOptionService) WithFormMailNotify(enabeld bool) *FormOption

WithFormMailNotify returns option to set `mailNotify` for wiki.

func (*WikiOptionService) WithFormName

func (*WikiOptionService) WithFormName(name string) *FormOption

WithFormName returns option to set `name` for wiki.

func (*WikiOptionService) WithQueryKeyword

func (*WikiOptionService) WithQueryKeyword(keyword string) *QueryOption

WithQueryKeyword returns option to set `keyword` for query parameter.

type WikiService

type WikiService struct {
	Attachment *WikiAttachmentService
	Option     *WikiOptionService
	// contains filtered or unexported fields
}

WikiService has methods for Wiki.

func (*WikiService) All

func (s *WikiService) All(projectIDOrKey string, options ...*QueryOption) ([]*Wiki, error)

All Wiki in project is gotten.

This method can specify the options returned by methods in "*Client.Wiki.Option".

Use the following methods:

WithQueryKeyword

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

func (*WikiService) Count

func (s *WikiService) Count(projectIDOrKey string) (int, error)

Count returns the number of wikis in the project.

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

func (*WikiService) Create

func (s *WikiService) Create(projectID int, name, content string, options ...*FormOption) (*Wiki, error)

Create creates a new Wiki for the project.

This method can specify the options returned by methods in "*Client.Wiki.Option".

Use the following methods:

WithFormMailNotify

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

func (*WikiService) Delete

func (s *WikiService) Delete(wikiID int, options ...*FormOption) (*Wiki, error)

Delete a wiki by ID.

This method can specify the options returned by methods in "*Client.Wiki.Option".

Use the following methods:

WithFormMailNotify

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

func (*WikiService) One

func (s *WikiService) One(wikiID int) (*Wiki, error)

One returns one of the wiki by ID.

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

func (*WikiService) Update

func (s *WikiService) Update(wikiID int, options ...*FormOption) (*Wiki, error)

Update a wiki.

This method can specify the options returned by methods in "*Client.Wiki.Option".

Use the following methods:

WithFormName
WithFormContent
WithFormMailNotify

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

Jump to

Keyboard shortcuts

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