api

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2016 License: GPL-3.0 Imports: 13 Imported by: 7

Documentation

Overview

The api package contains the interface and implementation of the terms service client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseURL

func BaseURL() string

Types

type Client

type Client interface {
	// Saves a Terms and Conditions document under the specified owner/name
	// and returns a term document with the new revision number
	// (only term owner, name and revision are returned).
	SaveTerm(owner, name, content string) (string, error)

	// GetTerm returns the term that matches the specified criteria.
	// If revision is 0, it will return the latest revision of the term.
	GetTerm(owner, name string, revision int) (*wireformat.Term, error)

	// GetUnsignedTerms checks for agreements to the specified terms
	// and returns all terms that the user has not agreed to.
	GetUnsignedTerms(*wireformat.CheckAgreementsRequest) ([]wireformat.GetTermsResponse, error)

	// SaveAgreement saves the users agreement to the specified terms (revision must always be specified).
	SaveAgreement(*wireformat.SaveAgreements) (*wireformat.SaveAgreementResponses, error)

	// GetUsersAgreements returns all agreements the user (the user making the request) has made.
	GetUsersAgreements() ([]wireformat.AgreementResponse, error)

	// Publish publishes the owned term identified by input parameters
	// and returns the published term id.
	// Only owned terms require publishing.
	Publish(owner, name string, revision int) (string, error)
}

Client represents the interface of the terms service client ap client apii.

func NewClient

func NewClient(options ...ClientOption) (Client, error)

NewClient returns a terms service api client.

type ClientOption

type ClientOption func(h *client)

ClientOption defines a function which configures a Client.

func HTTPClient

func HTTPClient(c httpClient) ClientOption

HTTPClient returns a function that sets the http client used by the API (e.g. if we want to use TLS).

func ServiceURL

func ServiceURL(serviceURL string) ClientOption

ServiceURL returns a function that sets the terms service URL used by the API.

Directories

Path Synopsis
The wireformat package contains definitions of wireformat used by the terms service.
The wireformat package contains definitions of wireformat used by the terms service.

Jump to

Keyboard shortcuts

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