Go client for the Drone API
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
drone fix incorrect method on resume and pause Oct 22, 2018
plugin secret plugin should accept path Oct 15, 2018
.drone.yml removed vendored files May 15, 2017
LICENSE Initial commit Feb 12, 2015
README.md removed vendored files May 15, 2017

README.md

drone-go

import (
	"github.com/drone/drone-go/drone"
	"golang.org/x/oauth2"
)

const (
	token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
	host  = "http://drone.company.com"
)

func main() {
	// create an http client with oauth authentication.
	config := new(oauth2.Config)
	auther := config.Client(
		oauth2.NoContext,
		&oauth2.Token{
			AccessToken: token,
		},
	)

	// create the drone client with authenticator
	client := drone.NewClient(host, auther)

	// gets the current user
	user, err := client.Self()
	fmt.Println(user, err)

	// gets the named repository information
	repo, err := client.Repo("drone", "drone-go")
	fmt.Println(repo, err)
}