client

package
v0.0.0-...-b5a1bf7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddEventParams

type AddEventParams struct {
	Description string `json:"description,omitempty"`
	EndTime     string `json:"end_time"`
	StartTime   string `json:"start_time"`
	Summary     string `json:"summary,omitempty"`
	TimeZone    string `json:"time_zone,omitempty"`
}

AddEventParams holds data passed in via `params` from the Conncourse task. StartTime and EndTime must be an RFC3339 formatted time string. For example, "2016-10-15T08:00:00+01:00"

type CalendarClient

type CalendarClient interface {

	// ListEvents takes a resource version and returns a list of resource versions.
	// It is assumed each calendar provider will provide some form of unique
	// identifier for each event. This identifier is used as the Concourse
	// resource version.
	//
	// If the requestedVersion is an event which is currently happening then
	// ListEvents should return a list containing just that version. Otherwise,
	// it should return a list containing all current versions.
	ListEvents(requestedVersion models.Version) []models.Version

	// GetEvent takes the `in` request data and a directory path under which
	// a file will be created. It uses the calendar provider's API to get
	// the event details necessary to provide a response on standard output
	// and populate a file. The file will then be placed in the Concourse
	// task's file system.
	GetEvent(*models.InRequest, string) (models.InResponse, *os.File, error)

	// AddEvent takes an `out` request and the path to the build sources and
	// creates a calendar event. The calendar client must make its own data
	// structures to hold the data passed in via `params`. It must os.Exit
	// if any error condition is encountered. It should return an OutResponse,
	// which is a single resource version (identified by an ID) representing
	// the created event.
	AddEvent(*models.OutRequest, string) models.OutResponse
}

CalendarClient is an interface that must be satisfied in order to implement other calendar providers.

func NewCalendarClient

func NewCalendarClient(source models.Source, args ...string) CalendarClient

func NewGoogleCalendarClient

func NewGoogleCalendarClient(source models.Source, args ...string) CalendarClient

type GoogleCalendarClient

type GoogleCalendarClient struct {
	Source     models.Source
	HTTPClient *http.Client
}

func (*GoogleCalendarClient) AddEvent

func (gcc *GoogleCalendarClient) AddEvent(outRequest *models.OutRequest, buildSourcePath string) models.OutResponse

func (*GoogleCalendarClient) GetEvent

func (gcc *GoogleCalendarClient) GetEvent(inRequest *models.InRequest, targetDirectory string) (models.InResponse, *os.File, error)

func (*GoogleCalendarClient) ListEvents

func (gcc *GoogleCalendarClient) ListEvents(requestedVersion models.Version) []models.Version

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL