Documentation
¶
Index ¶
- Constants
- Variables
- func Apply(ctx context.Context, eng flows.Engine, env envs.Environment, ...) (bool, error)
- func Read(sa flows.SessionAssets, data []byte, missing assets.MissingCallback) (flows.Modifier, error)
- func ReevaluateGroups(env envs.Environment, contact *flows.Contact, log flows.EventLogger)
- type Affinity
- type Channel
- type Field
- type Groups
- type GroupsModification
- type Language
- type Name
- type Routes
- type RoutesModification
- type Seen
- type Status
- type TicketAssignee
- type TicketClose
- type TicketNote
- type TicketOpen
- type TicketReopen
- type TicketTopic
- type Timezone
- type URNs
- type URNsModification
Constants ¶
const TypeAffinity string = "affinity"
TypeAffinity is the type of our affinity modifier
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 TypeRoutes string = "routes"
TypeRoutes is the type of our routes modifier
const TypeSeen string = "seen"
TypeSeen is the type of our seen modifier
const TypeStatus string = "status"
TypeStatus is the type of our status modifier
const TypeTicketAssignee string = "ticket_assignee"
TypeTicketAssignee is the type of our assignee modifier
const TypeTicketClose string = "ticket_close"
TypeTicketClose is the type of our close modifier
const TypeTicketNote string = "ticket_note"
TypeTicketNote is the type of our note modifier
const TypeTicketOpen string = "ticket_open"
TypeTicketOpen is the type of our ticket modifier
const TypeTicketReopen string = "ticket_reopen"
TypeTicketReopen is the type of our reopen modifier
const TypeTicketTopic string = "ticket_topic"
TypeTicketTopic is the type of our topic 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(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, c *flows.Contact, mod flows.Modifier, logEvent flows.EventLogger) (bool, error)
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.EventLogger)
ReevaluateGroups is a helper to re-evaluate groups and log any changes to membership
Types ¶
type Affinity ¶ added in v0.266.0
type Affinity struct {
// contains filtered or unexported fields
}
Affinity modifies the preferred URN and channel of a contact
func NewAffinity ¶ added in v0.266.0
NewAffinity creates a new affinity modifier
func (*Affinity) Apply ¶ added in v0.266.0
func (m *Affinity) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*Affinity) MarshalJSON ¶ added in v0.266.0
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(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
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(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
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(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
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 {
// 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(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*Language) MarshalJSON ¶ added in v0.256.0
type Name ¶ added in v0.249.0
type Name struct {
// contains filtered or unexported fields
}
Name modifies the name of a contact
func (*Name) Apply ¶ added in v0.249.0
func (m *Name) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*Name) MarshalJSON ¶ added in v0.256.0
type Routes ¶ added in v0.273.0
type Routes struct {
// contains filtered or unexported fields
}
Routes modifies the URNs on a contact while preserving channel affinity
func NewRoutes ¶ added in v0.273.0
func NewRoutes(routes []flows.Route, modification RoutesModification) *Routes
NewRoutes creates a new routes modifier
func (*Routes) Apply ¶ added in v0.273.0
func (m *Routes) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*Routes) MarshalJSON ¶ added in v0.273.0
type RoutesModification ¶ added in v0.273.0
type RoutesModification string
RoutesModification is the type of modification to make
const ( RoutesAppend RoutesModification = "append" RoutesRemove RoutesModification = "remove" RoutesSet RoutesModification = "set" )
the supported types of modification
type Seen ¶ added in v0.265.0
type Seen struct {
// contains filtered or unexported fields
}
Seen modifies the last seen of a contact
func (*Seen) Apply ¶ added in v0.265.0
func (m *Seen) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*Seen) MarshalJSON ¶ added in v0.265.0
type Status ¶ added in v0.249.0
type Status struct {
// 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(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*Status) MarshalJSON ¶ added in v0.256.0
type TicketAssignee ¶ added in v0.256.2
type TicketAssignee struct {
// contains filtered or unexported fields
}
TicketAssignee modifies the assignee of a ticket
func NewTicketAssignee ¶ added in v0.256.2
func NewTicketAssignee(ticketUUID flows.TicketUUID, assignee *flows.User) *TicketAssignee
NewTicketAssignee creates a new assignee modifier
func (*TicketAssignee) Apply ¶ added in v0.256.2
func (m *TicketAssignee) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*TicketAssignee) MarshalJSON ¶ added in v0.256.2
func (m *TicketAssignee) MarshalJSON() ([]byte, error)
type TicketClose ¶ added in v0.256.7
type TicketClose struct {
// contains filtered or unexported fields
}
TicketClose closes an open ticket
func NewTicketClose ¶ added in v0.256.7
func NewTicketClose(ticketUUID flows.TicketUUID) *TicketClose
NewTicketClose creates a new close modifier
func (*TicketClose) Apply ¶ added in v0.256.7
func (m *TicketClose) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*TicketClose) MarshalJSON ¶ added in v0.256.7
func (m *TicketClose) MarshalJSON() ([]byte, error)
type TicketNote ¶ added in v0.256.2
type TicketNote struct {
// contains filtered or unexported fields
}
TicketNote adds a note to a ticket
func NewTicketNote ¶ added in v0.256.2
func NewTicketNote(ticketUUID flows.TicketUUID, note string) *TicketNote
NewTicketNote creates a new note modifier
func (*TicketNote) Apply ¶ added in v0.256.2
func (m *TicketNote) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*TicketNote) MarshalJSON ¶ added in v0.256.2
func (m *TicketNote) MarshalJSON() ([]byte, error)
type TicketOpen ¶ added in v0.256.4
type TicketOpen struct {
// contains filtered or unexported fields
}
TicketOpen opens a ticket for the contact
func NewTicketOpen ¶ added in v0.256.4
NewTicketOpen creates a new ticket open modifier
func (*TicketOpen) Apply ¶ added in v0.256.4
func (m *TicketOpen) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*TicketOpen) MarshalJSON ¶ added in v0.256.4
func (m *TicketOpen) MarshalJSON() ([]byte, error)
type TicketReopen ¶ added in v0.256.8
type TicketReopen struct {
// contains filtered or unexported fields
}
TicketReopen reopens a closed ticket
func NewTicketReopen ¶ added in v0.256.8
func NewTicketReopen(ticketUUID flows.TicketUUID) *TicketReopen
NewTicketReopen creates a new reopen modifier
func (*TicketReopen) Apply ¶ added in v0.256.8
func (m *TicketReopen) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*TicketReopen) MarshalJSON ¶ added in v0.256.8
func (m *TicketReopen) MarshalJSON() ([]byte, error)
type TicketTopic ¶ added in v0.256.2
type TicketTopic struct {
// contains filtered or unexported fields
}
TicketTopic modifies the topic of a ticket
func NewTicketTopic ¶ added in v0.256.2
func NewTicketTopic(ticketUUID flows.TicketUUID, topic *flows.Topic) *TicketTopic
NewTicketTopic creates a new topic modifier
func (*TicketTopic) Apply ¶ added in v0.256.2
func (m *TicketTopic) Apply(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*TicketTopic) MarshalJSON ¶ added in v0.256.2
func (m *TicketTopic) MarshalJSON() ([]byte, error)
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(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
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 {
// 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(ctx context.Context, eng flows.Engine, env envs.Environment, sa flows.SessionAssets, contact *flows.Contact, log flows.EventLogger) (bool, error)
Apply applies this modification to the given contact
func (*URNs) MarshalJSON ¶ added in v0.256.0
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