Help us shape the future of Go! Take the 2026 Go Developer Survey

modifiers

package
v0.273.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 16 Imported by: 8

Documentation

Index

Constants

View Source
const TypeAffinity string = "affinity"

TypeAffinity is the type of our affinity modifier

View Source
const TypeChannel string = "channel"

TypeChannel is the type of our channel modifier

View Source
const TypeField string = "field"

TypeField is the type of our field modifier

View Source
const TypeGroups string = "groups"

TypeGroups is the type of our groups modifier

View Source
const TypeLanguage string = "language"

TypeLanguage is the type of our language modifier

View Source
const TypeName string = "name"

TypeName is the type of our name modifier

View Source
const TypeRoutes string = "routes"

TypeRoutes is the type of our routes modifier

View Source
const TypeSeen string = "seen"

TypeSeen is the type of our seen modifier

View Source
const TypeStatus string = "status"

TypeStatus is the type of our status modifier

View Source
const TypeTicketAssignee string = "ticket_assignee"

TypeTicketAssignee is the type of our assignee modifier

View Source
const TypeTicketClose string = "ticket_close"

TypeTicketClose is the type of our close modifier

View Source
const TypeTicketNote string = "ticket_note"

TypeTicketNote is the type of our note modifier

View Source
const TypeTicketOpen string = "ticket_open"

TypeTicketOpen is the type of our ticket modifier

View Source
const TypeTicketReopen string = "ticket_reopen"

TypeTicketReopen is the type of our reopen modifier

View Source
const TypeTicketTopic string = "ticket_topic"

TypeTicketTopic is the type of our topic modifier

View Source
const TypeTimezone string = "timezone"

TypeTimezone is the type of our timezone modifier

View Source
const TypeURNs string = "urns"

TypeURNs is the type of our URNs modifier

Variables

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

View Source
var RegisteredTypes = map[string]readFunc{}

RegisteredTypes is the registered modifier types

Functions

func Apply added in v0.164.3

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

func NewAffinity(urn urns.URN, channel *flows.Channel) *Affinity

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

func (m *Affinity) MarshalJSON() ([]byte, error)

func (*Affinity) Type added in v0.266.0

func (m *Affinity) Type() string

Type returns the type of this modifier

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

func NewChannel(channel *flows.Channel) *Channel

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

func (m *Channel) MarshalJSON() ([]byte, error)

func (*Channel) Type added in v0.249.0

func (m *Channel) Type() string

Type returns the type of this modifier

type Field added in v0.249.0

type Field struct {
	// contains filtered or unexported fields
}

Field modifies a field value on the contact

func NewField

func NewField(field *flows.Field, value string) *Field

NewField creates a new field modifier

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

func (m *Field) MarshalJSON() ([]byte, error)

func (*Field) Type added in v0.249.0

func (m *Field) Type() string

Type returns the type of this modifier

func (*Field) Value added in v0.249.0

func (m *Field) Value() string

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

func (m *Groups) MarshalJSON() ([]byte, error)

func (*Groups) Type added in v0.249.0

func (m *Groups) Type() string

Type returns the type of this modifier

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

func NewLanguage(language i18n.Language) *Language

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

func (m *Language) MarshalJSON() ([]byte, error)

func (*Language) Type added in v0.249.0

func (m *Language) Type() string

Type returns the type of this modifier

type Name added in v0.249.0

type Name struct {
	// contains filtered or unexported fields
}

Name modifies the name of a contact

func NewName

func NewName(name string) *Name

NewName creates a new name modifier

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

func (m *Name) MarshalJSON() ([]byte, error)

func (*Name) Type added in v0.249.0

func (m *Name) Type() string

Type returns the type of this modifier

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

func (m *Routes) MarshalJSON() ([]byte, error)

func (*Routes) Type added in v0.273.0

func (m *Routes) Type() string

Type returns the type of this modifier

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 NewSeen added in v0.265.0

func NewSeen(seenOn time.Time) *Seen

NewSeen creates a new seen modifier

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

func (m *Seen) MarshalJSON() ([]byte, error)

func (*Seen) Type added in v0.265.0

func (m *Seen) Type() string

Type returns the type of this modifier

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

func (m *Status) MarshalJSON() ([]byte, error)

func (*Status) Type added in v0.249.0

func (m *Status) Type() string

Type returns the type of this modifier

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

Apply applies this modification to the given contact

func (*TicketAssignee) MarshalJSON added in v0.256.2

func (m *TicketAssignee) MarshalJSON() ([]byte, error)

func (*TicketAssignee) Type added in v0.256.2

func (m *TicketAssignee) Type() string

Type returns the type of this modifier

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

Apply applies this modification to the given contact

func (*TicketClose) MarshalJSON added in v0.256.7

func (m *TicketClose) MarshalJSON() ([]byte, error)

func (*TicketClose) Type added in v0.256.7

func (m *TicketClose) Type() string

Type returns the type of this modifier

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

Apply applies this modification to the given contact

func (*TicketNote) MarshalJSON added in v0.256.2

func (m *TicketNote) MarshalJSON() ([]byte, error)

func (*TicketNote) Type added in v0.256.2

func (m *TicketNote) Type() string

Type returns the type of this modifier

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

func NewTicketOpen(topic *flows.Topic, assignee *flows.User, note string) *TicketOpen

NewTicketOpen creates a new ticket open modifier

func (*TicketOpen) Apply added in v0.256.4

Apply applies this modification to the given contact

func (*TicketOpen) MarshalJSON added in v0.256.4

func (m *TicketOpen) MarshalJSON() ([]byte, error)

func (*TicketOpen) Type added in v0.256.4

func (m *TicketOpen) Type() string

Type returns the type of this modifier

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

Apply applies this modification to the given contact

func (*TicketReopen) MarshalJSON added in v0.256.8

func (m *TicketReopen) MarshalJSON() ([]byte, error)

func (*TicketReopen) Type added in v0.256.8

func (m *TicketReopen) Type() string

Type returns the type of this modifier

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

Apply applies this modification to the given contact

func (*TicketTopic) MarshalJSON added in v0.256.2

func (m *TicketTopic) MarshalJSON() ([]byte, error)

func (*TicketTopic) Type added in v0.256.2

func (m *TicketTopic) Type() string

Type returns the type of this modifier

type Timezone added in v0.249.0

type Timezone struct {
	// contains filtered or unexported fields
}

Timezone modifies the timezone of a contact

func NewTimezone

func NewTimezone(timezone *time.Location) *Timezone

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

func (m *Timezone) MarshalJSON() ([]byte, error)

func (*Timezone) Type added in v0.249.0

func (m *Timezone) Type() string

Type returns the type of this modifier

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

func (m *URNs) MarshalJSON() ([]byte, error)

func (*URNs) Type added in v0.249.0

func (m *URNs) Type() string

Type returns the type of this modifier

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

Jump to

Keyboard shortcuts

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