mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-23 02:11:01 +00:00
7f4a205764
* delete obsolete cncd code jsonrpc2 client+server, and the utils that used them (piped, pipec) are not used anymore. jsonrpc2 was replaced with grpc piped+pipec were replaced by agents * delete duplicate section in swagger file * comment typos * go mod tidy (websocket+jsonrpc2 no longer used) * go mod vendor Co-authored-by: Anbraten <anton@ju60.de> |
||
---|---|---|
.. | ||
drone | ||
LICENSE | ||
README.md |
drone-go
import (
"github.com/woodpecker-ci/woodpecker/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)
}