waits

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const TypeMsg string = "msg"

TypeMsg is the type of our message wait

Variables

This section is empty.

Functions

func ReadWait added in v0.11.0

func ReadWait(data json.RawMessage) (flows.Wait, error)

ReadWait reads a wait from the given JSON

func RegisterType added in v0.11.0

func RegisterType(name string, initFunc func() flows.Wait)

RegisterType registers a new type of wait

Types

type MediaType added in v0.23.0

type MediaType string

MediaType describes a type of media we're waiting for. See note on `media_hint` field below.

const (
	MediaTypeImage    MediaType = "image"
	MediaTypeAudio    MediaType = "audio"
	MediaTypeVideo    MediaType = "video"
	MediaTypeLocation MediaType = "gps"
)

the different media types

type MsgWait

type MsgWait struct {

	// Waits can indicate to the caller what type of media the flow is expecting. In the case of flows of type
	// messaging_offline, this should be considered a requirement and the client should only reply with a message
	// containing an attachment of that type. In the case of other flow types this should be considered only a
	// hint to the channel, which may or may not support prompting the contact for media of that type.
	MediaHint_ MediaType `json:"media_hint,omitempty"`
	// contains filtered or unexported fields
}

MsgWait is a wait which waits for an incoming message (i.e. a msg_received event)

func NewMsgWait added in v0.4.0

func NewMsgWait(timeout *int, mediaHint MediaType) *MsgWait

NewMsgWait creates a new message wait

func (*MsgWait) Begin

func (w *MsgWait) Begin(run flows.FlowRun, step flows.Step) bool

Begin beings waiting at this wait

func (*MsgWait) End

func (w *MsgWait) End(resume flows.Resume) error

End ends this wait or returns an error

func (*MsgWait) Timeout

func (w *MsgWait) Timeout() *int

Timeout returns the timeout of this wait in seconds or nil if no timeout is set

func (*MsgWait) TimeoutOn added in v0.9.10

func (w *MsgWait) TimeoutOn() *time.Time

TimeoutOn returns when this wait times out

func (*MsgWait) Type

func (w *MsgWait) Type() string

Type returns the type of this wait

Jump to

Keyboard shortcuts

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