-
Notifications
You must be signed in to change notification settings - Fork 20
/
msg_wait.go
46 lines (38 loc) · 1.02 KB
/
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
40
41
42
43
44
45
46
package events
import (
"time"
"github.com/nyaruka/goflow/flows"
)
// 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
engineOnlyEvent
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(),
TimeoutOn: timeoutOn,
}
}
// Type returns the type of this event
func (e *MsgWaitEvent) Type() string { return TypeMsgWait }
// Apply applies this event to the given run
func (e *MsgWaitEvent) Apply(run flows.FlowRun) error {
return nil
}