resumes

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 for resuming a session with a message

View Source
const TypeRunExpiration string = "run_expiration"

TypeRunExpiration is the type for resuming a session when a run has expired

View Source
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 ReadMsgResume

func ReadMsgResume(session flows.Session, data json.RawMessage) (flows.Resume, error)

ReadMsgResume reads a message resume

func ReadResume

func ReadResume(session flows.Session, data json.RawMessage) (flows.Resume, error)

ReadResume reads a resume from the given JSON

func ReadRunExpirationResume

func ReadRunExpirationResume(session flows.Session, data json.RawMessage) (flows.Resume, error)

ReadRunExpirationResume reads a run expired resume

func ReadWaitTimeoutResume

func ReadWaitTimeoutResume(session flows.Session, data json.RawMessage) (flows.Resume, error)

ReadWaitTimeoutResume reads a timeout resume

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

func NewMsgResume(env utils.Environment, contact *flows.Contact, msg *flows.MsgIn) *MsgResume

NewMsgResume creates a new message resume with the passed in values

func (*MsgResume) Apply

func (r *MsgResume) Apply(run flows.FlowRun, step flows.Step) error

Apply applies our state changes and saves any events to the run

func (*MsgResume) Contact

func (r *MsgResume) Contact() *flows.Contact

func (*MsgResume) Environment

func (r *MsgResume) Environment() utils.Environment

func (*MsgResume) MarshalJSON added in v0.22.0

func (r *MsgResume) MarshalJSON() ([]byte, error)

MarshalJSON marshals this resume into JSON

func (*MsgResume) ResumedOn

func (r *MsgResume) ResumedOn() time.Time

func (*MsgResume) Type

func (r *MsgResume) Type() string

Type returns the type of this resume

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 utils.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, step flows.Step) error

Apply applies our state changes and saves any events to the run

func (*RunExpirationResume) Contact

func (r *RunExpirationResume) Contact() *flows.Contact

func (*RunExpirationResume) Environment

func (r *RunExpirationResume) Environment() utils.Environment

func (*RunExpirationResume) MarshalJSON added in v0.22.0

func (r *RunExpirationResume) MarshalJSON() ([]byte, error)

MarshalJSON marshals this resume into JSON

func (*RunExpirationResume) ResumedOn

func (r *RunExpirationResume) ResumedOn() time.Time

func (*RunExpirationResume) Type

func (r *RunExpirationResume) Type() string

Type returns the type of this resume

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 utils.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, step flows.Step) error

Apply applies our state changes and saves any events to the run

func (*WaitTimeoutResume) Contact

func (r *WaitTimeoutResume) Contact() *flows.Contact

func (*WaitTimeoutResume) Environment

func (r *WaitTimeoutResume) Environment() utils.Environment

func (*WaitTimeoutResume) MarshalJSON added in v0.22.0

func (r *WaitTimeoutResume) MarshalJSON() ([]byte, error)

MarshalJSON marshals this resume into JSON

func (*WaitTimeoutResume) ResumedOn

func (r *WaitTimeoutResume) ResumedOn() time.Time

func (*WaitTimeoutResume) Type

func (r *WaitTimeoutResume) Type() string

Type returns the type of this resume

Jump to

Keyboard shortcuts

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