Categorygithub.com/ttyfky/go-circleci
modulepackage
0.1.0
Repository: https://github.com/ttyfky/go-circleci.git
Documentation: pkg.go.dev

# README

go-circleci

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/bold-commerce/go-shopify"

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.

APIAvailability
Context (Preview)Available
InsightsNot Implemented
User (Preview)Not Implemented
PipelineNot Implemented
Job (Preview)Available
WorkflowAvailable
ProjectPartially Available

Note: Environment variable handling is part of Project API, but extracted as ProjectEnvVar it for convenience.

# Functions

NewClient creates new CircleCI client with given API token.
ProjectSlug assemle ProjectSlug of CircleCI.
WithHTTPClient optionally sets the http.Client.
WithPathPrefix optionally sets the API Prefix.

# Constants

No description provided by the author

# Structs

APIError represents an error from CircleCI.
Artifact represents artifact of a Job.
ArtifactList represents list of Artifact in a Job.
Client is a CircleCI client.
Context represents information about a context in CircleCI.
ContextCreate represents payload to create Context.
ContextEnvVar represents information about an environment variable of Context.
ContextEnvVarList represents a list of ContextEnvVar.
ContextList represents a list of Context variables.
ContextOp handles communication with the project related methods in the CircleCI API v2.
Job represents information about job in CircleCI.
JobOp handles communication with the project related methods in the CircleCI API v2.
Jobs represents information about a jobs having dependencies.
Message represents messages.
Metadata represents information about a test metadata of a Job.
Owner represents Owner used in ContextCreate.
Pipeline represents pipeline in CircleCI.
Project represents information about a project in CircleCI.
ProjectEnvVar represents an environment variable in a Project.
ProjectEnvVar represents a list of ProjectEnvVar.
ProjectEnvVarOp handles communication with the project related methods in the CircleCI API v2.
ProjectServiceOp handles communication with the project related methods in the CircleCI API v2.
RerunJob is a payload to send when rerunning jobs in Workflow.
TestMetadataList contains list of Metadata of test.
Workflow represents information workflow.
WorkflowJobs is jobs belongs to a Workflow.
WorkflowOp handles communication with the project related methods in the CircleCI API v2.

# Interfaces

ContextService is an interface for Context in Project API.
No description provided by the author
ProjectEnvVarService is an interface for ProjectEnvVar in Project API.
ProjectService is an interface for Project API.
WorkflowService is an interface for Workflow API.

# Type aliases

Option is used to configure client with options.