Skip to content

nattokin/go-backlog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-backlog

GoDoc Go Report Card Test codecov License: MIT

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.