Documentation ¶
Index ¶
- Constants
- func ReadResume(sessionAssets flows.SessionAssets, data json.RawMessage, ...) (flows.Resume, error)
- func RegisteredTypes() map[string]ReadFunc
- type Context
- type DialResume
- func (r *DialResume) Apply(run flows.Run, logEvent flows.EventCallback)
- func (r *DialResume) Contact() *flows.Contact
- func (r *DialResume) Context(env envs.Environment) map[string]types.XValue
- func (r *DialResume) Environment() envs.Environment
- func (r *DialResume) MarshalJSON() ([]byte, error)
- func (r *DialResume) ResumedOn() time.Time
- func (r *DialResume) Type() string
- type MsgResume
- func (r *MsgResume) Apply(run flows.Run, logEvent flows.EventCallback)
- func (r *MsgResume) Contact() *flows.Contact
- func (r *MsgResume) Context(env envs.Environment) map[string]types.XValue
- 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 ReadFunc
- type RunExpirationResume
- func (r *RunExpirationResume) Apply(run flows.Run, logEvent flows.EventCallback)
- func (r *RunExpirationResume) Contact() *flows.Contact
- func (r *RunExpirationResume) Context(env envs.Environment) map[string]types.XValue
- 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.Run, logEvent flows.EventCallback)
- func (r *WaitTimeoutResume) Contact() *flows.Contact
- func (r *WaitTimeoutResume) Context(env envs.Environment) map[string]types.XValue
- 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 TypeDial string = "dial"
TypeDial is the type for dial resumes
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 RegisteredTypes ¶ added in v0.56.2
RegisteredTypes gets the registered types of resumes
Types ¶
type Context ¶ added in v0.112.0
type Context struct {
// contains filtered or unexported fields
}
Context is the schema of trigger objects in the context, across all types
type DialResume ¶ added in v0.112.0
type DialResume struct {
// contains filtered or unexported fields
}
DialResume is used when a session is resumed after a number was dialed.
{ "type": "dial", "resumed_on": "2021-01-20T12:18:30Z", "dial": { "status": "answered", "duration": 15 } }
@resume dial
func NewDial ¶ added in v0.112.0
func NewDial(env envs.Environment, contact *flows.Contact, dial *flows.Dial) *DialResume
NewDial creates a new dial resume
func (*DialResume) Apply ¶ added in v0.112.0
func (r *DialResume) Apply(run flows.Run, logEvent flows.EventCallback)
Apply applies our state changes and saves any events to the run
func (*DialResume) Context ¶ added in v0.112.0
func (r *DialResume) Context(env envs.Environment) map[string]types.XValue
Context for dial resumes additionally exposes the dial object
func (*DialResume) Environment ¶ added in v0.112.0
func (r *DialResume) Environment() envs.Environment
func (*DialResume) MarshalJSON ¶ added in v0.112.0
func (r *DialResume) MarshalJSON() ([]byte, error)
MarshalJSON marshals this resume into JSON
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 (*MsgResume) Apply ¶
func (r *MsgResume) Apply(run flows.Run, logEvent flows.EventCallback)
Apply applies our state changes and saves any events to the run
func (*MsgResume) Context ¶ added in v0.112.0
func (r *MsgResume) Context(env envs.Environment) map[string]types.XValue
Context returns the properties available in expressions
type:text -> the type of resume that resumed this session
@context resume
func (*MsgResume) Environment ¶
func (r *MsgResume) Environment() envs.Environment
func (*MsgResume) MarshalJSON ¶ added in v0.22.0
MarshalJSON marshals this resume into JSON
type ReadFunc ¶ added in v0.56.2
type ReadFunc func(flows.SessionAssets, json.RawMessage, assets.MissingCallback) (flows.Resume, error)
ReadFunc is a function that can read a resume from 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 NewRunExpiration ¶ added in v0.48.0
func NewRunExpiration(env envs.Environment, contact *flows.Contact) *RunExpirationResume
NewRunExpiration creates a new run expired resume with the passed in values
func (*RunExpirationResume) Apply ¶
func (r *RunExpirationResume) Apply(run flows.Run, logEvent flows.EventCallback)
Apply applies our state changes and saves any events to the run
func (*RunExpirationResume) Context ¶ added in v0.112.0
func (r *RunExpirationResume) Context(env envs.Environment) map[string]types.XValue
Context returns the properties available in expressions
type:text -> the type of resume that resumed this session
@context resume
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 NewWaitTimeout ¶ added in v0.48.0
func NewWaitTimeout(env envs.Environment, contact *flows.Contact) *WaitTimeoutResume
NewWaitTimeout creates a new timeout resume with the passed in values
func (*WaitTimeoutResume) Apply ¶
func (r *WaitTimeoutResume) Apply(run flows.Run, logEvent flows.EventCallback)
Apply applies our state changes and saves any events to the run
func (*WaitTimeoutResume) Context ¶ added in v0.112.0
func (r *WaitTimeoutResume) Context(env envs.Environment) map[string]types.XValue
Context returns the properties available in expressions
type:text -> the type of resume that resumed this session
@context resume
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