wireformat

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: 3 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agreement

type Agreement struct {
	User      string      `json:"user"`
	Owner     string      `json:"owner"`
	Term      string      `json:"term"`
	Revision  int         `json:"revision"`
	CreatedOn TimeRFC3339 `json:"created-on"`
}

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

type AgreementRequest

type AgreementRequest struct {
	TermOwner    string `json:"termowner"`
	TermName     string `json:"termname"`
	TermRevision int    `json:"termrevision"`
}

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

type AgreementResponse

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

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

type Agreements

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

Agreements holds multiple agreements peformed in a single request.

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 CheckResult

type CheckResult struct {
	// Name is the human readable name for the check.
	Name string `json:"name"`

	// Value is the check result.
	Value string `json:"value"`

	// Passed reports whether the check passed.
	Passed bool `json:"passed"`

	// Duration holds the duration that the
	// status check took to run.
	Duration time.Duration `json:"duration"`
}

CheckResult holds the result of a single status check.

type DebugStatusResponse

type DebugStatusResponse struct {
	Checks map[string]CheckResult `json:"checks"`
}

DebugStatusResponse contains results of various checks that form the status of the terms service.

type GetTermsResponse

type GetTermsResponse struct {
	Name      string    `json:"name" yaml:"name"`
	Owner     string    `json:"owner,omitempty" yaml:"owner,omitempty"`
	Title     string    `json:"title" yaml:"title"`
	Revision  int       `json:"revision" yaml:"revision"`
	CreatedOn time.Time `json:"created-on" yaml:"createdon"`
	Content   string    `json:"content" yaml:"content"`
}

GetTermsResponse holds the response of the GetTerms call.

type SaveAgreement

type SaveAgreement struct {
	TermOwner    string `json:"termowner"`
	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.

type SaveTerm

type SaveTerm struct {
	Content string `json:"content"`
}

SaveTerm structure contains the content of the terms document to be saved.

func (*SaveTerm) Validate

func (t *SaveTerm) Validate() error

Validate validates the save term request.

type Term

type Term struct {
	Id        string      `json:"id" yaml:"id"`
	Owner     string      `json:"owner,omitempty" yaml:"owner,omitempty"`
	Name      string      `json:"name" yaml:"name"`
	Revision  int         `json:"revision" yaml:"revision"`
	Title     string      `json:"title,omitempty" yaml:"title,omitempty"`
	CreatedOn TimeRFC3339 `json:"created-on,omitempty" yaml:"createdon"`
	Published bool        `json:"published", yaml:"published"`
	Content   string      `json:"content,omitempty" yaml:"content,omitempty"`
}

Term contains the terms and conditions document structure.

type TermIDResponse

type TermIDResponse struct {
	TermID string `json:"term-id"`
}

TermIDResponse contains just the termID

type Terms

type Terms []Term

Terms stores a sortable slice of terms.

func (Terms) Len

func (terms Terms) Len() int

Len implements sort.Interface

func (Terms) Less

func (terms Terms) Less(i, j int) bool

Less implements sort.Interface

func (Terms) Swap

func (terms Terms) Swap(i, j int)

Swap implements sort.Interface

type TimeRFC3339

type TimeRFC3339 time.Time

TimeRFC3339 represents a time, which is marshaled and unmarshaled using the RFC3339 format

func (TimeRFC3339) MarshalJSON

func (t TimeRFC3339) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (TimeRFC3339) MarshalYAML

func (t TimeRFC3339) MarshalYAML() (interface{}, error)

MarshalYAML implements gopkg.in/juju/yaml.v2 Marshaler interface.

func (*TimeRFC3339) UnmarshalJSON

func (t *TimeRFC3339) UnmarshalJSON(data []byte) error

UnmarshalJSON implements the json.Unmarshaler interface.

func (*TimeRFC3339) UnmarshalYAML

func (t *TimeRFC3339) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

Jump to

Keyboard shortcuts

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