builder

package
v0.0.0-...-f8d3b81 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnableLogging

func EnableLogging(writer io.Writer)

func ListParams

func ListParams(cmd *Command) []string

func SafeName

func SafeName(s string) string

Types

type API

type API struct {
	Name     string
	BaseURL  string
	Header   map[string]StringOrList //[]string
	Query    map[string]StringOrList //[]string
	Commands []Command
	Set      *APISet
}

API in a set for multiple Commands

func (*API) FindCommand

func (api *API) FindCommand(name string) ([]*Command, error)

func (*API) FindCommandExact

func (api *API) FindCommandExact(name string) (*Command, error)

type APISet

type APISet struct {
	APIs []API `json:"apis"`
}

APISet for multiple APIs

func (*APISet) CreateRequest

func (set *APISet) CreateRequest(api, command string, sources ...SourceFn) (*http.Request, error)

CreateRequest by searching the set for a single api/command combination

func (*APISet) FindAPI

func (set *APISet) FindAPI(name string) ([]*API, error)

type Command

type Command struct {
	Name   string
	Path   string
	Method string
	Header map[string]StringOrList //[]string
	Query  map[string]StringOrList //[]string
	Body   *CommandBody
	API    *API
}

Command on an API

func (Command) CreateRequest

func (cmd Command) CreateRequest(sources ...SourceFn) (*http.Request, error)

CreateRequest

type CommandBody

type CommandBody struct {
	Data []byte
}

func (*CommandBody) String

func (body *CommandBody) String() string

func (*CommandBody) UnmarshalJSON

func (body *CommandBody) UnmarshalJSON(data []byte) error

type InvalidOperation

type InvalidOperation string

InvalidOperation error

func (InvalidOperation) Error

func (e InvalidOperation) Error() string

type NotFound

type NotFound string

NotFound api or command

func (NotFound) Error

func (e NotFound) Error() string

type SourceErrorFn

type SourceErrorFn func(error)

type SourceFn

type SourceFn func(string) string

func NewEnvVarsSource

func NewEnvVarsSource(list []string) SourceFn

NewEnvVarsSource allows environment variables to be a data source

func NewFlagSource

func NewFlagSource(args []string, errLog SourceErrorFn) SourceFn

type StringOrList

type StringOrList []string

func (StringOrList) MarshalJSON

func (s StringOrList) MarshalJSON() ([]byte, error)

func (*StringOrList) UnmarshalJSON

func (s *StringOrList) UnmarshalJSON(data []byte) error

Jump to

Keyboard shortcuts

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