Documentation
¶
Index ¶
- Constants
- Variables
- func Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, ...) bool
- func Read(sa flows.SessionAssets, data []byte, missing assets.MissingCallback) (flows.Modifier, error)
- func ReevaluateGroups(env envs.Environment, contact *flows.Contact, log flows.EventCallback)
- type Channel
- type Field
- type Groups
- type GroupsModification
- type Language
- type Name
- type Status
- type Ticket
- type Timezone
- type URNs
- type URNsModification
Constants ¶
const TypeChannel string = "channel"
TypeChannel is the type of our channel modifier
const TypeField string = "field"
TypeField is the type of our field modifier
const TypeGroups string = "groups"
TypeGroups is the type of our groups modifier
const TypeLanguage string = "language"
TypeLanguage is the type of our language modifier
const TypeName string = "name"
TypeName is the type of our name modifier
const TypeStatus string = "status"
TypeStatus is the type of our status modifier
const TypeTicket string = "ticket"
TypeTicket is the type of our ticket modifier
const TypeTimezone string = "timezone"
TypeTimezone is the type of our timezone modifier
const TypeURNs string = "urns"
TypeURNs is the type of our URNs modifier
Variables ¶
var ErrNoModifier = errors.New("no modifier to return because of missing assets")
ErrNoModifier is the error instance returned when a modifier is read but due to missing assets can't be returned
var RegisteredTypes = map[string]readFunc{}
RegisteredTypes is the registered modifier types
Functions ¶
func Apply ¶ added in v0.164.3
func Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, c *flows.Contact, mod flows.Modifier, logEvent flows.EventCallback) bool
Apply applies the given modifier to the given contact and re-evaluates query based groups if necessary
func Read ¶ added in v0.249.0
func Read(sa flows.SessionAssets, data []byte, missing assets.MissingCallback) (flows.Modifier, error)
Read reads a modifier from the given JSON
func ReevaluateGroups ¶ added in v0.134.1
func ReevaluateGroups(env envs.Environment, contact *flows.Contact, log flows.EventCallback)
ReevaluateGroups is a helper to re-evaluate groups and log any changes to membership
Types ¶
type Channel ¶ added in v0.249.0
type Channel struct {
// contains filtered or unexported fields
}
Channel modifies the preferred channel of a contact
func NewChannel ¶
NewChannel creates a new channel modifier
func (*Channel) Apply ¶ added in v0.249.0
func (m *Channel) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
func (*Channel) MarshalJSON ¶ added in v0.249.0
type Field ¶ added in v0.249.0
type Field struct {
// contains filtered or unexported fields
}
Field modifies a field value on the contact
func (*Field) Apply ¶ added in v0.249.0
func (m *Field) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
func (*Field) MarshalJSON ¶ added in v0.249.0
type Groups ¶ added in v0.249.0
type Groups struct {
// contains filtered or unexported fields
}
Groups modifies the group membership of the contact
func NewGroups ¶
func NewGroups(groups []*flows.Group, modification GroupsModification) *Groups
NewGroups creates a new groups modifier
func (*Groups) Apply ¶ added in v0.249.0
func (m *Groups) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
func (*Groups) MarshalJSON ¶ added in v0.249.0
type GroupsModification ¶
type GroupsModification string
GroupsModification is the type of modification to make
const ( GroupsAdd GroupsModification = "add" GroupsRemove GroupsModification = "remove" )
the supported types of modification
type Language ¶ added in v0.249.0
type Language struct {
Language i18n.Language `json:"language"`
// contains filtered or unexported fields
}
Language modifies the language of a contact
func NewLanguage ¶
NewLanguage creates a new language modifier
func (*Language) Apply ¶ added in v0.249.0
func (m *Language) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
type Name ¶ added in v0.249.0
type Name struct {
Name string `json:"name"`
// contains filtered or unexported fields
}
Name modifies the name of a contact
func (*Name) Apply ¶ added in v0.249.0
func (m *Name) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
type Status ¶ added in v0.249.0
type Status struct {
Status flows.ContactStatus `json:"status" validate:"contact_status"`
// contains filtered or unexported fields
}
Status modifies the status of a contact
func NewStatus ¶
func NewStatus(status flows.ContactStatus) *Status
NewStatus creates a new status modifier
func (*Status) Apply ¶ added in v0.249.0
func (m *Status) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
type Ticket ¶ added in v0.249.0
type Ticket struct {
// contains filtered or unexported fields
}
Ticket opens a ticket for the contact
func (*Ticket) Apply ¶ added in v0.249.0
func (m *Ticket) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
func (*Ticket) MarshalJSON ¶ added in v0.249.0
type Timezone ¶ added in v0.249.0
type Timezone struct {
// contains filtered or unexported fields
}
Timezone modifies the timezone of a contact
func NewTimezone ¶
NewTimezone creates a new timezone modifier
func (*Timezone) Apply ¶ added in v0.249.0
func (m *Timezone) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
func (*Timezone) MarshalJSON ¶ added in v0.249.0
type URNs ¶ added in v0.249.0
type URNs struct {
URNs []urns.URN `json:"urns" validate:"required"`
Modification URNsModification `json:"modification" validate:"required,eq=append|eq=remove|eq=set"`
// contains filtered or unexported fields
}
URNs modifies the URNs on a contact
func NewURNs ¶
func NewURNs(urnz []urns.URN, modification URNsModification) *URNs
NewURNs creates a new URNs modifier
func (*URNs) Apply ¶ added in v0.249.0
func (m *URNs) Apply(eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventCallback) bool
Apply applies this modification to the given contact
type URNsModification ¶
type URNsModification string
URNsModification is the type of modification to make
const ( URNsAppend URNsModification = "append" URNsRemove URNsModification = "remove" URNsSet URNsModification = "set" )
the supported types of modification