api

package
v0.0.0-...-12ec42c Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudFunc

type CloudFunc struct {
	// contains filtered or unexported fields
}

CloudFunc represents communication interface

func NewCloudFunc

func NewCloudFunc() *CloudFunc

func (*CloudFunc) GetRequest

func (c *CloudFunc) GetRequest() (*Request, error)

GetRequest accepts an request and unmarshals it to Request

func (*CloudFunc) SendResponse

func (c *CloudFunc) SendResponse(i interface{}) error

SendResponse marshalls given interface using json.Marshal and sends it back as a function output If the interface can't be serialized, it will be returned as a pure string

type Request

type Request struct {
	BaseURL     string            `json:"baseUrl"`
	Body        json.RawMessage   `json:"body"`
	Hostname    string            `json:"hostname"`
	IP          string            `json:"ip"`
	Method      string            `json:"method"`
	OriginalURL string            `json:"originalUrl"`
	Query       map[string]string `json:"query"`
}

Request is structure that represents http request that comes to function

func (*Request) BindBody

func (r *Request) BindBody(i interface{}) error

BindBody binds request's body to given interface

Jump to

Keyboard shortcuts

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