api

package
Version: v0.0.0-...-309e9be Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {

	// body serialization format
	BodyFormat format.BodyFormat

	// event frame
	Frame parser.Event
}

Event represents pub/sub event

func (*Event) Id

func (e *Event) Id() string

Id returns unique event identifier

func (*Event) RawBody

func (e *Event) RawBody() []byte

RawBody returns event data as a raw (unparsed) byte array

func (*Event) Read

func (e *Event) Read(to interface{})

Read reads (parses) event body to object

type EventHandler

type EventHandler func(*Event)

EventHandler

type Request

type Request struct {

	// body serialization format
	BodyFormat format.BodyFormat

	// request frame
	Frame parser.Request
}

Request represents request that came to request handler

func (*Request) Id

func (r *Request) Id() string

Id returns unique identifier of request

func (*Request) RawBody

func (r *Request) RawBody() []byte

RawBody returns raw (unparsed) request body as byte array

func (*Request) Read

func (r *Request) Read(to interface{})

Read reads (parses) request data into object

type RequestHandler

type RequestHandler func(*Request, *Response)

RequestHandler

type Response

type Response struct {

	// Body serialization format
	BodyFormat format.BodyFormat

	// Output channel to push response when ready
	Out chan parser.Frame

	// Optional request frame for this response
	RequestFrame *parser.Request

	// Response frame
	Frame *parser.Response
}

/ Response represents response for a request

func (*Response) Done

func (r *Response) Done(obj interface{})

Done sends done response to requester party

func (*Response) Error

func (r *Response) Error(obj interface{})

Error sends error response to requester party

func (*Response) Id

func (r *Response) Id() string

Id returns unique identifier of response

func (*Response) IsDone

func (r *Response) IsDone() bool

IsDone indicates that this is successed response

func (*Response) IsError

func (r *Response) IsError() bool

IsError indicates that this is errored response

func (*Response) IsProgress

func (r *Response) IsProgress() bool

IsProgress indicates progressive response

func (*Response) Progress

func (r *Response) Progress(obj interface{})

Progress sends done response to requester party

func (*Response) Read

func (r *Response) Read(to interface{})

Read reads (parses) response data into object

func (*Response) RequestId

func (r *Response) RequestId() string

RequestId returns unique identifier of Request of this resposne

type ResponseHandler

type ResponseHandler func(*Response)

ResponseHandler

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL