resumes

package
v0.226.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 12 Imported by: 9

Documentation

Index

Constants

View Source
const TypeDial string = "dial"

TypeDial is the type for dial resumes

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 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

func RegisteredTypes() map[string]ReadFunc

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) Contact added in v0.112.0

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

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

func (*DialResume) ResumedOn added in v0.112.0

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

func (*DialResume) Type added in v0.112.0

func (r *DialResume) Type() string

Type returns the type of this resume

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 NewMsg added in v0.48.0

func NewMsg(env envs.Environment, contact *flows.Contact, msg *flows.MsgIn) *MsgResume

NewMsg creates a new message resume with the passed in values

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) Contact

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

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

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

MarshalJSON marshals this resume into JSON

func (*MsgResume) Msg added in v0.28.7

func (r *MsgResume) Msg() *flows.MsgIn

Msg returns the msg this resume is based on

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 ReadFunc added in v0.56.2

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) Contact

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

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

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 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) Contact

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

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

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