{{ .Title }}

{{ range .Docs }}
{{ .HTML }}
{{ end }} {{ range .Sections }}

{{ .Title }}

{{ .Intro }}

{{ range .Entries }}

{{ .CmdName }} #

{{ .Doc }}
{{ if .HasRequest }}
Request
{{ template "typeref" .Request }}
{{ end }} {{ if .HasResponse }}
{{ if .IsEvent }}Payload{{ else }}Response{{ end }}
{{ template "typeref" .Response }}
{{ end }}
{{ end }}
{{ end }}
{{ define "typeref" }} {{ if eq .Kind "struct" }} {{ if .Fields }}
{ ... } ({{ len .Fields }} field{{ if ne (len .Fields) 1 }}s{{ end }})
{{ else }}
struct {}
{{ end }} {{ else if and (eq .Kind "named") .Fields }}
{{ template "typelabel" . }}({{ len .Fields }} field{{ if ne (len .Fields) 1 }}s{{ end }})
{{ else if and (eq .Kind "named") .EmptyStruct }}
{{ template "typelabel" . }} (empty object)
{{ else if or (eq .Kind "slice") (eq .Kind "array") }} {{ $fields := flattenedFields . }} {{ if $fields }}
{{ template "typelabel" . }}({{ len $fields }} field{{ if ne (len $fields) 1 }}s{{ end }} per {{ flattenedFieldUnit . }})
{{ else if hasInline . }}
{{ template "typelabel" . }}
{{ template "typeref" .Elem }}
{{ else }}
{{ template "typelabel" . }}
{{ end }} {{ else if eq .Kind "map" }} {{ $fields := flattenedFields . }} {{ if $fields }}
{{ template "typelabel" . }}({{ len $fields }} field{{ if ne (len $fields) 1 }}s{{ end }} per {{ flattenedFieldUnit . }})
{{ else if hasInline . }}
{{ template "typelabel" . }}
{{ template "typeref" .Elem }}
{{ else }}
{{ template "typelabel" . }}
{{ end }} {{ else }}
{{ template "typelabel" . }}
{{ end }} {{ end }} {{ define "typelabel" -}}{{ template "typelabel-inline" . }}{{- end }} {{ define "typelabel-inline" }} {{- if eq .Kind "basic" -}} {{ .Display }} {{- else if eq .Kind "named" -}} {{- if .PkgAlias -}}{{ .PkgAlias }}.{{- end -}}{{ .Name }}{{- if .TypeArgs -}}[{{- range $i, $a := .TypeArgs -}}{{- if $i -}}, {{ end -}}{{- template "typelabel-inline" $a -}}{{- end -}}]{{- end -}} {{- if .Underlying }}({{ .Underlying }}){{ end -}} {{- if .Recursive }}(recursive){{ end -}} {{- else if eq .Kind "slice" -}} []{{ template "typelabel-inline" .Elem }} {{- else if eq .Kind "array" -}} [{{ .ArrayLen }}]{{ template "typelabel-inline" .Elem }} {{- else if eq .Kind "map" -}} map[{{ template "typelabel-inline" .Key }}]{{ template "typelabel-inline" .Elem }} {{- else if eq .Kind "struct" -}} struct {{ "{" }} ... {{ "}" }} {{- else if eq .Kind "interface" -}} any {{- else -}} {{ .Display }} {{- end -}} {{ end }} {{ define "field" }}
  • {{ .JSONName }} {{ template "typelabel" .Type }} {{ if .Optional }}optional{{ end }} {{ if .Embedded }}embedded{{ end }}
    {{ if .Doc }}
    {{ .Doc }}
    {{ end }} {{ if hasInline .Type }}
    {{ template "typeref" .Type }}
    {{ end }}
  • {{ end }}