-
Notifications
You must be signed in to change notification settings - Fork 20
/
msg_wait.go
39 lines (32 loc) · 904 Bytes
/
msg_wait.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package events
import (
"time"
"github.com/nyaruka/goflow/flows"
)
func init() {
RegisterType(TypeMsgWait, func() flows.Event { return &MsgWaitEvent{} })
}
// TypeMsgWait is the type of our msg wait event
const TypeMsgWait string = "msg_wait"
// MsgWaitEvent events are created when a flow pauses waiting for a response from
// a contact. If a timeout is set, then the caller should resume the flow after
// the number of seconds in the timeout to resume it.
//
// {
// "type": "msg_wait",
// "created_on": "2006-01-02T15:04:05Z",
// "timeout": 300
// }
//
// @event msg_wait
type MsgWaitEvent struct {
BaseEvent
TimeoutOn *time.Time `json:"timeout_on,omitempty"`
}
// NewMsgWait returns a new msg wait with the passed in timeout
func NewMsgWait(timeoutOn *time.Time) *MsgWaitEvent {
return &MsgWaitEvent{
BaseEvent: NewBaseEvent(TypeMsgWait),
TimeoutOn: timeoutOn,
}
}