Documentation ¶
Index ¶
- type Generator
- func (g *Generator) ClientName() string
- func (g *Generator) EmitClientClass(writer io.Writer, serviceType *bridge.Type) error
- func (g *Generator) EmitServiceCallMethod(writer io.Writer, opName string, opType *bridge.FunctionTypeData, ...) error
- func (g *Generator) EmitTypeReader(writer io.Writer, argType *bridge.Type) error
- func (g *Generator) EmitTypeWriter(writer io.Writer, argType *bridge.Type) error
- func (g *Generator) EmitTypeWriterBody(writer io.Writer, argType *bridge.Type) error
- func (g *Generator) EmitTypeWriterFooter(writer io.Writer, argType *bridge.Type) error
- func (g *Generator) EmitTypeWriterHeader(writer io.Writer, argType *bridge.Type) error
- func (g *Generator) IOMethodForType(t *bridge.Type) string
- func (g *Generator) MarkType(types ...*bridge.Type) string
- func (g *Generator) MarkTypes(types []*bridge.Type) string
- func (g *Generator) ServiceTypeData() *bridge.RecordTypeData
- func (g *Generator) TypeWriterBodyString(argType *bridge.Type) string
- type HttpBinding
- type HttpInputBinder
- type RestProtocol
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Generator ¶
type Generator struct { // where the templates are Bindings map[string]*HttpBinding TypeLib bridge.ITypeLibrary TemplatesDir string // Parameters to determine Generated output Package string ClientPackageName string ServiceName string ClientPrefix string ClientSuffix string ServiceType *bridge.Type TransportRequest string OpName string OpType *bridge.FunctionTypeData OpMethod string OpEndpoint string ExistingWriters map[string]string ExistingReaders map[string]string // Callbacks from the template to mark certain items in the code generation TypeMarker func(types ...*bridge.Type) // contains filtered or unexported fields }
*
- Responsible for generating the code for the client classes.
func NewGenerator ¶
func NewGenerator(bindings map[string]*HttpBinding, typeLib bridge.ITypeLibrary, templatesDir string) *Generator
func (*Generator) ClientName ¶
func (*Generator) EmitClientClass ¶
*
- Emits the class that captures all the methods for sendign service calls and
- receiving parsing the responses.
func (*Generator) EmitServiceCallMethod ¶
func (g *Generator) EmitServiceCallMethod(writer io.Writer, opName string, opType *bridge.FunctionTypeData, argPrefix string) error
*
- For a given service operation, emits a method which:
- 1. Has inputs the same as those of the underlying service operation,
- 2. creates a transport level request
- 3. Sends the transport level request
- 4. Gets a response from the transport level and returns it
func (*Generator) EmitTypeWriterBody ¶
func (*Generator) EmitTypeWriterFooter ¶
func (*Generator) EmitTypeWriterHeader ¶
func (*Generator) ServiceTypeData ¶
func (g *Generator) ServiceTypeData() *bridge.RecordTypeData
type HttpBinding ¶
type HttpBinding struct { /** * Methods required to match for this binding to get triggered. */ Methods []string /** * The URL which will trigger this binding. */ Url string // Mappings between a query or BODY parameter to a key with the request ParamMappings map[string][]string // Mappings between a path variable to a key with the request VarMappings map[string][]string /** * The service that needs to be invoked when the binding matches. */ Service interface{} /** * Name of the operation to invoke. */ Operation string /** * Type of the request object to be created and populated. */ RequestType reflect.Type RequestTypeIsPtr bool /** * The method corresponding to the operation within the service. */ Method reflect.Value }
func NewHttpBinding ¶
func NewHttpBinding(url string, methods []string, service interface{}, operation string) *HttpBinding
type HttpInputBinder ¶
type HttpInputBinder struct { // Methods that are ok for this Bindings []*HttpBinding }
func (*HttpInputBinder) AddBinding ¶
func (h *HttpInputBinder) AddBinding(binding *HttpBinding)
func (*HttpInputBinder) MatchBinding ¶
func (h *HttpInputBinder) MatchBinding(request *http.Request) *HttpBinding
type RestProtocol ¶
type RestProtocol struct { }
func (*RestProtocol) WriteReadResponseMethod ¶
func (protocl *RestProtocol) WriteReadResponseMethod(opName string, opType *bridge.FunctionTypeData)
Click to show internal directories.
Click to hide internal directories.