protocol

package
v0.0.0-...-d81bb10 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Request

type Request struct {
	Method     string              `json:"method"`
	Resource   string              `json:"resource"`
	Tag        string              `json:"tag"`
	Parameters map[string][]string `json:"parameters"`
}

Request is data sent to the Gutenfinder API.

func (*Request) GetParameter

func (request *Request) GetParameter(parameter string) ([]string, error)

GetParameter gets the value of the given parameter. An error is returned if the parameter is not defined.

func (*Request) GetSingleParameter

func (request *Request) GetSingleParameter(parameter string) (string, error)

GetSingleParameter gets the first value of the given parameter. An error is returned if the parameter is not defined, or if there are not exactly one values.

func (*Request) String

func (request *Request) String() string

func (*Request) Summary

func (request *Request) Summary() string

Summary returns a brief description of the Request.

func (*Request) Validate

func (request *Request) Validate() error

Validate returns an error if the request is not valid. For instance, if the request does not use a valid HTTP method.

type Response

type Response struct {
	StatusCode int    `json:"status_code"`
	Tag        string `json:"tag"`
	HTML       string `json:"html"`
	Error      string `json:"error"`
}

Response is data returned from the Gutenfinder API.

func ErrorResponse

func ErrorResponse(status int, tag string, err error) *Response

ErrorResponse creates a response that signifies an error.

func (*Response) String

func (response *Response) String() string

Jump to

Keyboard shortcuts

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