This is a Go client of CircleCI API v2.
This API is implemented by following the public docs by CircleCI.
$ go get github.com/ttyfky/go-circleci
import "github.com/ttyfky/go-circleci"
CircleCI supports two types of authentication 1. api_key_header and 2. basic_auth.
This Client currently supports api_key_header authentication.
Get API token by following instruction before using this client.
Give API token to NewClient
function.
token := "API_TOKEN"
client := circleci.NewClient(token)
Use resource service in the client to call API of each resources in CircleCI.
client := circleci.NewClient(token)
workflowID := "ID"
workflow, _ := client.Workflow.Get(workflowID)
More examples are availablein example_test.go.
Not all of the APIs are implemented yet. It's more based on demand of the actions. The table below shows the API's availability as of Jan 2021.
Preview
means it's preview phase in CircleCI side.
API | Availability |
---|---|
Context (Preview) | Available |
Insights | Not Implemented |
User (Preview) | Not Implemented |
Pipeline | Not Implemented |
Job (Preview) | Available |
Workflow | Available |
Project | Partially Available |
Note: Environment variable handling is part of Project API, but extracted as ProjectEnvVar
it for convenience.