Documentation
¶
Index ¶
Constants ¶
const Version = "0.1.0"
Version is the current version of the package
Variables ¶
var ( // ErrUnknownResource is returned by GetResourceFor if it can’t find a // resource ErrUnknownResource = errors.New("Unknown resource") // ErrUnknownStatusCode is returned by GetStatusCode if it can’t find a // status code ErrUnknownStatusCode = errors.New("Unknown status code") // ErrUnknownHeader is returned by GetHeader if it can’t find an header // field ErrUnknownHeader = errors.New("Unknown header field") // ErrUnknownMethod is returned by GetMethod if it can’t find a method ErrUnknownMethod = errors.New("Unknown method") )
Functions ¶
This section is empty.
Types ¶
type Doc ¶
type Doc struct {
// the root dir in which are the documentation files
RootDir string
}
Doc represents a documentation source
var DefaultDoc Doc
DefaultDoc is a Doc which assumes you installed the binary/library using `go get`.
func (Doc) GetResourceFor ¶
GetResourceFor gets a name and tries to find a corresponding resource. It'll return ErrUnknownResource if it can’t find it.
func (Doc) GetStatusCode ¶
func (d Doc) GetStatusCode(code string) (c StatusCode, err error)
GetStatusCode gets a code and returns a new StatusCode struct describing it. If it can’t find the code an ErrUnknownStatusCode is returned.
type Header ¶
type Header struct {
// Type is either "request", "response", or "both"
Type string
// Text is the header’s text
Text string
// Desc is an human-readable description of the header
Desc string
// Refs are some references for the reader
Refs []string
}
Header is an HTTP header field
func (Header) PrettyString ¶
PrettyString returns an human-readable description of the header
type Method ¶
type Method struct {
// Verb is the method’s verb
Verb string
// Desc is an human-readable description of the method
Desc string
// Refs are some references for the reader
Refs []string
}
Method is an HTTP method
func (Method) PrettyString ¶
PrettyString returns an human-readable description of this method
type NilResource ¶
type NilResource struct{}
NilResource is an empty resource
var InvalidResource NilResource
InvalidResource is returned by some functions where a Resource is needed but no one can be found
func (NilResource) PrettyString ¶
func (n NilResource) PrettyString() string
PrettyString returns an empty string
func (NilResource) String ¶
func (n NilResource) String() string
type Resource ¶
type Resource interface {
String() string
// PrettyString is intended as a more verbose `String()` for user display
PrettyString() string
}
A Resource is a documented resource
type StatusCode ¶
type StatusCode struct {
// Code is its actual code (e.g. "200")
Code string
// Text is a short text describing the status code (e.g. "OK")
Text string
// Desc is an human-readable description of the status code
Desc string
// Refs are some references for the reader
Refs []string
}
A StatusCode is an HTTP status code
func (StatusCode) PrettyString ¶
func (c StatusCode) PrettyString() string
PrettyString returns a string describing the status code with a long description and a references list.
func (StatusCode) String ¶
func (c StatusCode) String() string