Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( GitCommit string GitTag string EsVersion string )
Functions ¶
This section is empty.
Types ¶
type Body ¶
type Body struct { Endpoint *Endpoint `json:"-"` Description string `json:"description"` Required bool `json:"required"` ContentType string `json:"serialize"` }
Body represents API endpoint body.
type Command ¶
type Command struct { Input string Output string Gofmt bool DebugInfo bool DebugSource bool ColorizeSource bool }
Command represents the "gensource" command.
type Endpoint ¶
type Endpoint struct { Name string `json:"-"` Type string `json:"-"` Documentation struct { URL string `json:"url"` Description string `json:"description"` } `json:"documentation"` Stability string `json:"stability"` URL *URL `json:"url"` Params map[string]*Param `json:"params"` Body *Body `json:"body"` }
Endpoint represents an API endpoint.
func NewEndpoint ¶
NewEndpoint creates a new API endpoint.
func (*Endpoint) HumanMethodWithNamespace ¶
HumanMethodWithNamespace returns the API endpoint method name in humanized form.
func (*Endpoint) MethodName ¶
MethodName returns the API endpoint method name.
func (*Endpoint) MethodWithNamespace ¶
MethodWithNamespace returns the API endpoint method name with namespace.
func (*Endpoint) RequiredArguments ¶
func (e *Endpoint) RequiredArguments() []MethodArgument
RequiredArguments return the list of required method arguments.
type Generator ¶
type Generator struct { Endpoint *Endpoint // contains filtered or unexported fields }
Generator represents the "gensource" generator.
func (*Generator) GetOverride ¶
func (g *Generator) GetOverride(id, apiName string) OverrideFunc
GetOverride returns an override function for id and API name.
type MethodArgument ¶
type MethodArgument struct { Endpoint *Endpoint Name string Type string Description string Options []string Default interface{} Required bool }
MethodArgument represents a method argument for API endpoint.
func (*MethodArgument) GoName ¶
func (p *MethodArgument) GoName() string
GoName returns a Go name for method argument.
func (*MethodArgument) GoType ¶
func (p *MethodArgument) GoType(comment ...bool) string
GoType returns a Go type for method argument.
type OverrideFunc ¶
OverrideFunc defines a function to override generated code for endpoint.
type OverrideRule ¶
type OverrideRule struct { Func OverrideFunc Matching []string }
OverrideRule represents an override rule.
func (OverrideRule) Match ¶
func (r OverrideRule) Match(apiName string) bool
Match returns true when API name matches a rule.
type Param ¶
type Param struct { Endpoint *Endpoint `json:"-"` Name string `json:"-"` Type string `json:"type"` Description string `json:"description"` Options []string `json:"options"` Default interface{} `json:"default"` Required bool `json:"required"` }
Param represents API endpoint parameter.
type Part ¶
type Part struct { Endpoint *Endpoint `json:"-"` Name string `json:"-"` Default interface{} `json:"-"` Type string `json:"type"` Description string `json:"description"` Required bool `json:"required"` Deprecated bool `json:"deprecated"` }
Part represents part of the API endpoint URL.
type Path ¶
type Path struct { Path string `json:"path"` Methods []string `json:"methods"` Parts map[string]*Part `json:"parts"` Deprecated struct { Version string `json:"version"` Description string `json:"description"` } }
Path represents URL path
type URL ¶
type URL struct { Endpoint *Endpoint `json:"-"` Paths []Path `json:"paths"` DeprecatedPaths []struct { Path string `json:"path"` Version string `json:"version"` Description string `json:"description"` } `json:"deprecated_paths"` Params map[string]*Param `json:"params"` AllParts map[string]*Part PartNamesSorted []string ParamNamesSorted []string }
URL represents API endpoint URL.