terms

package
v0.0.0-...-0231bf2 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2016 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package terms contains the terms service API client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPClient

func HTTPClient(c httpClient) func(h *client) error

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

Types

type AgreementResponse

type AgreementResponse struct {
	User      string    `json:"user"`
	Term      string    `json:"term"`
	Revision  int       `json:"revision"`
	CreatedOn time.Time `json:"created-on"`
}

AgreementResponse holds the a single agreement made by the user to a specific revision of terms and conditions document.

type CheckAgreementsRequest

type CheckAgreementsRequest struct {
	Terms []string
}

CheckAgreementsRequest holds a slice of terms and the /v1/agreement endpoint will check if the user has agreed to the specified terms and return a slice of terms the user has not agreed to yet.

type Client

type Client interface {
	GetUnsignedTerms(p *CheckAgreementsRequest) ([]GetTermsResponse, error)
	SaveAgreement(p *SaveAgreements) (*SaveAgreementResponses, error)
}

Client defines method needed for the Terms Service CLI commands.

func NewClient

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

NewClient returns a new client for plan management.

type ClientOption

type ClientOption func(h *client) error

ClientOption defines a function which configures a Client.

type GetTermsResponse

type GetTermsResponse struct {
	Name      string    `json:"name"`
	Revision  int       `json:"revision"`
	CreatedOn time.Time `json:"created-on"`
	Content   string    `json:"content"`
}

GetTermsResponse holds the response of the GetTerms call.

type SaveAgreement

type SaveAgreement struct {
	TermName     string `json:"termname"`
	TermRevision int    `json:"termrevision"`
}

SaveAgreement holds the parameters for creating a new user agreement to a specific revision of terms.

type SaveAgreementResponses

type SaveAgreementResponses struct {
	Agreements []AgreementResponse `json:"agreements"`
}

SaveAgreementResponses holds the response of the SaveAgreement call.

type SaveAgreements

type SaveAgreements struct {
	Agreements []SaveAgreement `json:"agreements"`
}

SaveAgreements holds the parameters for creating new user agreements to one or more specific revisions of terms.

Jump to

Keyboard shortcuts

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