page

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var T = template.Must(template.New("t").Funcs(helpers).Parse(strings.Join([]string{
	page_root,

	sidebar,
	sidebar_header,
	sidebar_footer,
	sidebar_lists,
	sidebar_item,

	content,
	content_header,
	content_footer,
	content_articles,

	article,
	article_primary_column,
	article_example_column,
	article_section_list,
	article_lead,
	article_text,
	article_auth_info,
	article_field_list,

	field_list,
	field_item,
	field_children,

	enum_list,

	example_section_list,
	example_endpoints,
	example_text,
	example_object,
	example_response,
	example_request,
	example_request_topbar,
	example_request_body,

	code_snippet_http,
	code_snippet_curl,

	code_block_pre,
	svg_code_icon,
	svg_code_icon_use,
	curl_data,
}, "")))

Functions

This section is empty.

Types

type ArticleAuthInfo

type ArticleAuthInfo struct {
	Title string
	Text  template.HTML
}

type ArticleElement

type ArticleElement struct {
	// The id attribute of the article.
	Id string
	// The URL path to the article.
	Path string
	// The article's anchor.
	Href string
	// The article's title.
	Title string
	// A link to the source code associated with the article.
	SourceLink *SourceLink
	// The article's HTML text.
	Text template.HTML
	// A list of additional sections of the article.
	Sections []ArticleSection
	// An example related to the article.
	Example ExampleElement
	// A list of sub articles.
	SubArticles []*ArticleElement
	// If set, indicates that this article has no parent article.
	IsRoot bool
}

type ArticleFieldList

type ArticleFieldList struct {
	Title string
	Lists []*FieldList
}

type ArticleSection

type ArticleSection interface {
	// contains filtered or unexported methods
}

type ArticleText

type ArticleText struct {
	Title string
	Text  template.HTML
}

type CURLDataKeyValue

type CURLDataKeyValue struct {
	Key   string
	Value string
}

type CURLDataText

type CURLDataText string

func (CURLDataText) HTML

func (s CURLDataText) HTML() template.HTML

type CURLDataType

type CURLDataType interface {
	// contains filtered or unexported methods
}

////////////////////////////////////////////////////////////////////////////// cURL specific types //////////////////////////////////////////////////////////////////////////////

type CodeSnippet

type CodeSnippet interface {
	// contains filtered or unexported methods
}

type CodeSnippetCURL

type CodeSnippetCURL struct {
	// The target URL
	URL string
	// The -X/--request option
	X string
	// The -H/--header options
	H []string
	// the -d/--data options
	Data []CURLDataType
}

func (*CodeSnippetCURL) ClassMethod

func (cs *CodeSnippetCURL) ClassMethod() string

func (*CodeSnippetCURL) NumOpts

func (cs *CodeSnippetCURL) NumOpts() int

type CodeSnippetElement

type CodeSnippetElement struct {
	Id       string // the id of the snippet's primary element
	Show     bool   // indicates whether or not to show this snippet
	Lang     string // the language of the snippet's code
	NumLines int    // the number of lines needed to render the snippet
	Snippet  CodeSnippet
}

func (*CodeSnippetElement) Lines

func (e *CodeSnippetElement) Lines() []struct{}

type CodeSnippetHTTP

type CodeSnippetHTTP struct {
	// The start line
	Method, RequestURI, HTTPVersion string
	// The header fields
	Headers []HeaderItem
	// The message body
	Body template.HTML
}

CodeSnippetHTTP represents a raw HTTP request message.

func (*CodeSnippetHTTP) ClassMethod

func (cs *CodeSnippetHTTP) ClassMethod() string

type Content

type Content struct {
	Header   Header
	Articles []*ArticleElement
	Footer   Footer
}

type EndpointItem

type EndpointItem struct {
	Href    string
	Method  string
	Pattern string
	Tooltip string
}

type EnumItem

type EnumItem struct {
	// The enum's value.
	Value string
	// The enum's documentation text.
	Text template.HTML
	// A link to the source of the enum's declaration.
	SourceLink *SourceLink
}

type EnumList

type EnumList struct {
	// The title to be use for the enum list.
	Title string
	Items []*EnumItem
}

type ExampleElement

type ExampleElement struct {
	Sections []ExampleSection
}

type ExampleEndpoints

type ExampleEndpoints struct {
	Title     string
	Endpoints []*EndpointItem
}

type ExampleObject

type ExampleObject struct {
	Title string
	Lang  string
	Code  template.HTML
}

type ExampleRequest

type ExampleRequest struct {
	Title    string
	Method   string
	Pattern  string
	Options  []*SelectOption
	Snippets []*CodeSnippetElement
}

type ExampleResponse

type ExampleResponse struct {
	Title  string
	Status int           // The HTTP response status
	Header []HeaderItem  // The response's header
	Lang   string        // the body's language type
	Code   template.HTML // The response's body
}

type ExampleSection

type ExampleSection interface {
	// contains filtered or unexported methods
}

type ExampleText

type ExampleText struct {
	Title string
	Text  template.HTML
}

type FieldItem

type FieldItem struct {
	// The unique identifier of the item.
	Id string
	// The href linking to the item.
	Href string
	// The name of the field.
	Name string
	// The path to the field's name if nested, otherwise empty.
	Path string
	// The name of the field's type.
	Type string
	// The field's documentation.
	Text template.HTML
	// A link to the source of the field.
	SourceLink *SourceLink
	// SettingLabel and SettingText are used to indicates whether the field
	// is required, optional, or something else. The SettingLabel is used as
	// part of the associated CSS class name. The SettingText is used as the
	// text to be rendered in the documentation.
	SettingLabel, SettingText string
	// The field's validation documentation.
	Validation template.HTML
	// A list of enum values associated with the field's type.
	EnumList *EnumList
	// If the field's type is a struct then SubFields will hold the fields
	// of that struct. If the field's type is not a struct then SubFields
	// will be nil.
	SubFields []*FieldItem
}

type FieldList

type FieldList struct {
	Title string
	Class FieldListClass
	Items []*FieldItem
}

type FieldListClass

type FieldListClass uint
const (
	FIELD_LIST_HEADER FieldListClass
	FIELD_LIST_PATH
	FIELD_LIST_QUERY
	FIELD_LIST_BODY
	FIELD_LIST_OBJECT
)

func (FieldListClass) String

func (c FieldListClass) String() string
type Footer struct {
}
type Header struct {
	// ...
	SigninURL template.URL // TODO
	Search    interface{}  // TODO
}

type HeaderItem

type HeaderItem struct {
	Key   string
	Value string
}

type Page

type Page struct {
	Title   string
	Sidebar Sidebar
	// NOTE(mkopriva): The code that's writing the Page into files relies on
	// the Content field to be a non-pointer. If it later needs to be changed
	// to a pointer, then the page-writing code needs to be updated to create
	// a shallow copy of the pointed-to Content.
	Content Content
	// The id of the element which should act as the anchor for the initial page load.
	AnchorId string

	AddCustomCSS bool
	RandomHash   string
}

type SelectOption

type SelectOption struct {
	Text  string
	Value string
}
type Sidebar struct {
	Header SidebarHeader
	Lists  []*SidebarList
	Footer SidebarFooter
}

type SidebarBanner

type SidebarBanner interface {
	// contains filtered or unexported methods
}

type SidebarBannerHTML

type SidebarBannerHTML struct {
	Text template.HTML
}

type SidebarBannerTitle

type SidebarBannerTitle struct {
	Text string
	URL  template.URL
}

type SidebarFooter

type SidebarFooter struct {
}

type SidebarHeader

type SidebarHeader struct {
	Banner SidebarBanner
}

type SidebarItem

type SidebarItem struct {
	Text     string
	Href     string
	Anchor   string
	SubItems []*SidebarItem
}

func (*SidebarItem) ListItemClass

func (si *SidebarItem) ListItemClass() string

type SidebarList

type SidebarList struct {
	Title string
	Items []*SidebarItem
}
type SourceLink struct {
	// The link to the source code.
	Href string
	// The text inside the anchor.
	Text string
}

Jump to

Keyboard shortcuts

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