Go-SemaphoreCI
go-semaphoreci is a Go client library for accessing the Semaphore CI API.
Examples
API v1
import (
"log"
"github.com/ldez/go-semaphoreci/v1"
)
func main() {
transport := v1.TokenTransport{
Token: "your-token",
}
client := v1.NewClient(transport.Client())
projects, _, err := client.Projects.Get()
if err != nil {
log.Fatal(err)
}
for _, project := range projects {
log.Println(project)
}
}
API v2
import (
"log"
"github.com/ldez/go-semaphoreci/v2"
)
func main() {
authToken := v2.TokenTransport{
Token: "your-token",
}
client := v2.NewClient(authToken.Client())
projects, resp, err := client.Projects.GetByOrg("your-organization")
if err != nil {
log.Fatal(err)
}
log.Println("HTTP response: ", resp)
for _, project := range projects {
log.Println(project)
}
}
Documentation
https://godoc.org/github.com/ldez/go-semaphoreci