Documentation
¶
Index ¶
- Constants
- func CreateEndpointHandler(endpoint Endpoint) http.HandlerFunc
- func ExtractQueryParameters(url *url.URL, separator string) map[string]string
- type ArrayParameter
- type BoolParameter
- type Endpoint
- type FastCGI
- type FileParameter
- type HttpMethodDescriptor
- type IntegerParameter
- type Model
- type ModelElement
- type NumberParameter
- type ObjectParameter
- type Parameter
- type ParameterList
- type ParameterValueFormat
- type ResponseDescriptor
- type StandaloneServer
- type StringParameter
- type UnsupportedParameterValueFormat
Constants ¶
const ( FormatText = ParameterValueFormat(0) FormatJSON = ParameterValueFormat(1) FormatBinary = ParameterValueFormat(2) FormatXML = ParameterValueFormat(3) )
Formats
const (
TemplateParamBody = "body"
)
Variables ¶
This section is empty.
Functions ¶
func CreateEndpointHandler ¶
func CreateEndpointHandler(endpoint Endpoint) http.HandlerFunc
creates HTTP handler for the specified endpoint
Types ¶
type ArrayParameter ¶
type BoolParameter ¶
Represents parameter of type Boolean
type Endpoint ¶
type Endpoint interface {
ModelElement
PathParameters() ParameterList //path parameters
GetMethodDescriptor(method string) HttpMethodDescriptor
}
Describes single endpoint
type FileParameter ¶
type FileParameter interface {
Parameter
//Indicates that file should be saved into temporary file. Otherwise, it will be recorded into memory
Persistent() bool
}
Represents file content as a parameter value of this parameter can be represented as BASE64 string in case of plain/text format value of this parameter can be represented as quoted BASE64 string in case of application/json format value of this parameter can be represented as raw set of bytes in case of application/octet-stream format
type HttpMethodDescriptor ¶
type HttpMethodDescriptor interface {
ModelElement
Executor() cmdexec.CommandExecutor
QueryParameters() ParameterList
RequestHeaders() ParameterList
Request() ParameterList //definition of body bounded to MIME types
Response() map[int]ResponseDescriptor //mapping between exit code of process and response
}
Describes HTTP method
type IntegerParameter ¶
type Model ¶
type Model interface {
Endpoints() map[string]Endpoint //set of endpoints declared in the model
Name() string //name of model
}
REST model describes command execution
type ModelElement ¶
type ModelElement interface {
//Indicates that custom option is defined for model element
HasOption(directive string) bool
}
Represents model element
type NumberParameter ¶
type ObjectParameter ¶
type ObjectParameter interface {
Parameter
Fields() ParameterList
}
type Parameter ¶
type Parameter interface {
ModelElement
Required() bool //parameter is required to be presented
HasDefaultValue() bool //parameter has default value
Validate(value interface{}) bool //validate value of parameter
ReadValue(value io.Reader, format ParameterValueFormat) (interface{}, error)
}
Represents parameter in model this interface can be used to represent variant parameter type
type ParameterValueFormat ¶
type ParameterValueFormat int8
func GetFormatByMIME ¶
func GetFormatByMIME(mediaType string) ParameterValueFormat
type ResponseDescriptor ¶
type ResponseDescriptor struct {
Body Parameter //response parameter description
StatusCode int //HTTP status code
MimeType string //MIME type
}
Describes response associated with exit code
type StandaloneServer ¶
func (*StandaloneServer) Close ¶
func (self *StandaloneServer) Close() error
func (*StandaloneServer) Run ¶
func (self *StandaloneServer) Run(async bool) error
type StringParameter ¶
Represents parameter of type String
type UnsupportedParameterValueFormat ¶
type UnsupportedParameterValueFormat struct {
}
func (UnsupportedParameterValueFormat) Error ¶
func (UnsupportedParameterValueFormat) Error() string