Skip to content

ttyfky/go-circleci

Repository files navigation

go-circleci

godoc License

This is a Go client of CircleCI API v2.

This API is implemented by following the public docs by CircleCI.

Install

$ go get github.com/ttyfky/go-circleci

Use

import "github.com/ttyfky/go-circleci"

Authentication

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

Get API token by following instruction before using this client.

Create Client

Give API token to NewClient function.

token := "API_TOKEN"
client := circleci.NewClient(token)

API call

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.

API availability

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.

About

Go client of CircleCI API v2

Resources

License

Stars

Watchers

Forks

Packages

No packages published