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

modifiers

package
v0.255.2 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 14 Imported by: 8

Documentation

Index

Constants

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 TypeStatus string = "status"

TypeStatus is the type of our status modifier

View Source
const TypeTicket string = "ticket"

TypeTicket is the type of our ticket 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.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

func NewChannel(channel *flows.Channel) *Channel

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

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

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

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 {
	Language i18n.Language `json:"language"`
	// 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(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 (*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 {
	Name string `json:"name"`
	// 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(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 (*Name) Type added in v0.249.0

func (m *Name) Type() string

Type returns the type of this modifier

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

func (*Status) Type added in v0.249.0

func (m *Status) Type() string

Type returns the type of this modifier

type Ticket added in v0.249.0

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

Ticket opens a ticket for the contact

func NewTicket added in v0.165.0

func NewTicket(topic *flows.Topic, assignee *flows.User, note string) *Ticket

NewTicket creates a new ticket modifier

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

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

func (*Ticket) Type added in v0.249.0

func (m *Ticket) 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(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

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

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