Documentation ¶
Index ¶
- Constants
- func ReadResume(sessionAssets flows.SessionAssets, data json.RawMessage, ...) (flows.Resume, error)
- func RegisterType(name string, f readFunc)
- type MsgResume
- func (r *MsgResume) Apply(run flows.FlowRun, logEvent flows.EventCallback) error
- func (r *MsgResume) Contact() *flows.Contact
- func (r *MsgResume) Environment() envs.Environment
- func (r *MsgResume) MarshalJSON() ([]byte, error)
- func (r *MsgResume) Msg() *flows.MsgIn
- func (r *MsgResume) ResumedOn() time.Time
- func (r *MsgResume) Type() string
- type RunExpirationResume
- func (r *RunExpirationResume) Apply(run flows.FlowRun, logEvent flows.EventCallback) error
- func (r *RunExpirationResume) Contact() *flows.Contact
- func (r *RunExpirationResume) Environment() envs.Environment
- func (r *RunExpirationResume) MarshalJSON() ([]byte, error)
- func (r *RunExpirationResume) ResumedOn() time.Time
- func (r *RunExpirationResume) Type() string
- type WaitTimeoutResume
- func (r *WaitTimeoutResume) Apply(run flows.FlowRun, logEvent flows.EventCallback) error
- func (r *WaitTimeoutResume) Contact() *flows.Contact
- func (r *WaitTimeoutResume) Environment() envs.Environment
- func (r *WaitTimeoutResume) MarshalJSON() ([]byte, error)
- func (r *WaitTimeoutResume) ResumedOn() time.Time
- func (r *WaitTimeoutResume) Type() string
Constants ¶
const TypeMsg string = "msg"
TypeMsg is the type for resuming a session with a message
const TypeRunExpiration string = "run_expiration"
TypeRunExpiration is the type for resuming a session when a run has expired
const TypeWaitTimeout string = "wait_timeout"
TypeWaitTimeout is the type for resuming a session when a wait has timed out
Variables ¶
This section is empty.
Functions ¶
func ReadResume ¶
func ReadResume(sessionAssets flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Resume, error)
ReadResume reads a resume from the given JSON
func RegisterType ¶
func RegisterType(name string, f readFunc)
RegisterType registers a new type of trigger
Types ¶
type MsgResume ¶
type MsgResume struct {
// contains filtered or unexported fields
}
MsgResume is used when a session is resumed with a new message from the contact
{ "type": "msg", "contact": { "uuid": "9f7ede93-4b16-4692-80ad-b7dc54a1cd81", "name": "Bob", "created_on": "2018-01-01T12:00:00.000000Z", "language": "fra", "fields": {"gender": {"text": "Male"}}, "groups": [] }, "msg": { "uuid": "2d611e17-fb22-457f-b802-b8f7ec5cda5b", "channel": {"uuid": "61602f3e-f603-4c70-8a8f-c477505bf4bf", "name": "Twilio"}, "urn": "tel:+12065551212", "text": "hi there", "attachments": ["https://s3.amazon.com/mybucket/attachment.jpg"] }, "resumed_on": "2000-01-01T00:00:00.000000000-00:00" }
@resume msg
func NewMsgResume ¶
NewMsgResume creates a new message resume with the passed in values
func (*MsgResume) Environment ¶
func (r *MsgResume) Environment() envs.Environment
func (*MsgResume) MarshalJSON ¶ added in v0.22.0
MarshalJSON marshals this resume into JSON
type RunExpirationResume ¶
type RunExpirationResume struct {
// contains filtered or unexported fields
}
RunExpirationResume is used when a session is resumed because the waiting run has expired
{ "type": "run_expiration", "contact": { "uuid": "9f7ede93-4b16-4692-80ad-b7dc54a1cd81", "name": "Bob", "created_on": "2018-01-01T12:00:00.000000Z", "language": "fra", "fields": {"gender": {"text": "Male"}}, "groups": [] }, "resumed_on": "2000-01-01T00:00:00.000000000-00:00" }
@resume run_expiration
func NewRunExpirationResume ¶
func NewRunExpirationResume(env envs.Environment, contact *flows.Contact) *RunExpirationResume
NewRunExpirationResume creates a new run expired resume with the passed in values
func (*RunExpirationResume) Apply ¶
func (r *RunExpirationResume) Apply(run flows.FlowRun, logEvent flows.EventCallback) error
Apply applies our state changes and saves any events to the run
func (*RunExpirationResume) Environment ¶
func (r *RunExpirationResume) Environment() envs.Environment
func (*RunExpirationResume) MarshalJSON ¶ added in v0.22.0
func (r *RunExpirationResume) MarshalJSON() ([]byte, error)
MarshalJSON marshals this resume into JSON
type WaitTimeoutResume ¶
type WaitTimeoutResume struct {
// contains filtered or unexported fields
}
WaitTimeoutResume is used when a session is resumed because a wait has timed out
{ "type": "wait_timeout", "contact": { "uuid": "9f7ede93-4b16-4692-80ad-b7dc54a1cd81", "name": "Bob", "created_on": "2018-01-01T12:00:00.000000Z", "language": "fra", "fields": {"gender": {"text": "Male"}}, "groups": [] }, "resumed_on": "2000-01-01T00:00:00.000000000-00:00" }
@resume wait_timeout
func NewWaitTimeoutResume ¶
func NewWaitTimeoutResume(env envs.Environment, contact *flows.Contact) *WaitTimeoutResume
NewWaitTimeoutResume creates a new timeout resume with the passed in values
func (*WaitTimeoutResume) Apply ¶
func (r *WaitTimeoutResume) Apply(run flows.FlowRun, logEvent flows.EventCallback) error
Apply applies our state changes and saves any events to the run
func (*WaitTimeoutResume) Environment ¶
func (r *WaitTimeoutResume) Environment() envs.Environment
func (*WaitTimeoutResume) MarshalJSON ¶ added in v0.22.0
func (r *WaitTimeoutResume) MarshalJSON() ([]byte, error)
MarshalJSON marshals this resume into JSON