Skip to content

nwidger/lighthouse

Repository files navigation

Golang Lighthouse API

GoDoc

A Golang client library for interacting with the Lighthouse API.

See cmd/lh for a Lighthouse CLI client based on this library.

Installation

go get -u github.com/nwidger/lighthouse

Usage

import "github.com/nwidger/lighthouse"

// Create an *http.Client which will authenticate with your Lighthouse
// API token.
client := lighthouse.NewClient("your-api-token")

// Or create an *http.Client which will authenticate with your Lighthouse
// API token and automatically rate limit API requests.
client := lighthouse.NewClientWithRateLimit("your-api-token")

// Or create an *http.Client which will authenticate with your
// Lighthouse email/password.
client := lighthouse.NewClientBasicAuth("your-email", "your-password")

// Or create an *http.Client which will authenticate with your
// Lighthouse email/password and automatically rate limit API requests.
client := lighthouse.NewClientBasicAuthWithRateLimit("your-email", "your-password")

// Create a *lighthouse.Service with your Lighthouse account and client.
// 'https://your-account-name.lighthouseapp.com'.
s := lighthouse.NewService("your-account-name", client)

// Create a service for interacting with each resource type in your
// account.

// Some resources are project specific.
projectID := 123456

// http://help.lighthouseapp.com/kb/api/ticket-bins
binsService := bins.NewService(s, projectID)

// http://help.lighthouseapp.com/kb/api/changesets
changesetService := changesets.NewService(s, projectID)

// http://help.lighthouseapp.com/kb/api/messages
messagesService := messages.NewService(s, projectID)

// http://help.lighthouseapp.com/kb/api/milestones
milestonesService := milestones.NewService(s, projectID)

// http://help.lighthouseapp.com/kb/api/projects
projectsService := projects.NewService(s)

// http://help.lighthouseapp.com/kb/api/tickets
ticketsService := tickets.NewService(s, projectID)

// http://help.lighthouseapp.com/kb/api/users-and-membership
profilesService := profiles.NewService(s)
tokensService := tokens.NewService(s)
usersService := users.NewService(s)

// Call List(), Get(), New(), Create(), Update(), Delete(),
// etc. methods on service.

See GoDoc reference for more details on each service type.