apidoc

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2020 License: MIT Imports: 10 Imported by: 2

Documentation

Overview

Package apidoc is a way to define self documenting HTTP API's.

Index

Constants

This section is empty.

Variables

View Source
var DefaultStyle = Style(`
html, body { margin: 0 0; padding: 0 0; }
body {
  padding: 1em 1.618em 1em 1.618em;
}
h1:first-child {
  margin-top: 0;
}
.request {
  padding: 1em 1.618em;
}

.response {
  padding: 1em 1.618em;
  background-color: #f2f2f2;
  border-radius: 1em;
}
`)

Functions

func JsonResponse

func JsonResponse(resp *http.Response) *Element

func JsonResponseFrom

func JsonResponseFrom(h http.Handler, r *http.Request) *Element

func RawRequest

func RawRequest(r *http.Request) *Element

func RawResponse

func RawResponse(resp *http.Response) *Element

func RawResponseFrom

func RawResponseFrom(h http.Handler, r *http.Request) *Element

Types

type Doc

type Doc struct {
	*http.Request
	// contains filtered or unexported fields
}

func NewDoc

func NewDoc(router http.Handler) *Doc

NewDoc returns a documentation generator for your router

func (*Doc) JsonResponse

func (d *Doc) JsonResponse() *Element

func (*Doc) NewRequest

func (d *Doc) NewRequest(method, path string, body io.Reader) *Element

func (*Doc) Response

func (d *Doc) Response() *Element

func (*Doc) Use

func (d *Doc) Use(r *http.Request) *Element

Jump to

Keyboard shortcuts

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