Skip to content

kochie/zeit-api-go

Repository files navigation

ZEIT API

Build Status GoDoc Coverage Status Go Report Card

go get github.com/kochie/zeit-api-go

Example

package main

import (
	"fmt"
	"github.com/kochie/zeit-api-go"
)

func main(){
	token := "secret token"
	
	zeitClient := zeit.NewClient(token)
	zeitClient.Team("team name") // Team name can be optionally set
	
	domains, err := zeitClient.GetAllDomains()
	if err != nil {
		fmt.Println(err.Error())
	}
	
	for _, domain := range domains {
		fmt.Println(domain)
	}
}

Testing

Each method should have sufficient test coverage and an integration test. To facillitate the development of tests there is a mocking interface set up which can be used. Mocks can be created using the go generate command or by using the mockgen command.

# Example mocking of HttpClient
mockgen -destination=mocks/mock_http_client.go -package=mocks github.com/kochie/zeit-api-go HttpClient

Integration tests will not run unless the integration flag is set.

go test -tags integration

More information about setting up a development environment can be found in the contribution guide.

APIs

As listed in the API documentation

Currently supported endpoints are.

  • Domains
  • DNS
  • OAuth2
  • Authentication
  • Deployments
  • Logs
  • Certificates
  • Aliases
  • Secrets
  • Teams
  • Projects