go-semaphoreci is a Go client library for accessing the Semaphore CI API.
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)
}
}
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)
}
}