Documentation ¶
Index ¶
- Constants
- Variables
- func ReadModifier(assets flows.SessionAssets, data json.RawMessage, ...) (flows.Modifier, error)
- func RegisterType(name string, f readFunc)
- type ChannelModifier
- type FieldModifier
- type GroupsModification
- type GroupsModifier
- type LanguageModifier
- type NameModifier
- type TimezoneModifier
- type URNModification
- type URNModifier
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 TypeTimezone string = "timezone"
TypeTimezone is the type of our timezone modifier
const TypeURN string = "urn"
TypeURN is the type of our URN 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 ReadModifier ¶
func ReadModifier(assets flows.SessionAssets, data json.RawMessage, missing assets.MissingCallback) (flows.Modifier, error)
ReadModifier reads a modifier from the given JSON
func RegisterType ¶
func RegisterType(name string, f readFunc)
RegisterType registers a new type of modifier
Types ¶
type ChannelModifier ¶
type ChannelModifier struct {
// contains filtered or unexported fields
}
ChannelModifier modifies the preferred channel of a contact
func NewChannelModifier ¶
func NewChannelModifier(channel *flows.Channel) *ChannelModifier
NewChannelModifier creates a new channel modifier
func (*ChannelModifier) Apply ¶
func (m *ChannelModifier) Apply(env utils.Environment, assets flows.SessionAssets, contact *flows.Contact, log flows.EventCallback)
Apply applies this modification to the given contact
func (*ChannelModifier) MarshalJSON ¶
func (m *ChannelModifier) MarshalJSON() ([]byte, error)
type FieldModifier ¶
type FieldModifier struct {
// contains filtered or unexported fields
}
FieldModifier modifies a field value on the contact
func NewFieldModifier ¶
func NewFieldModifier(field *flows.Field, value *flows.Value) *FieldModifier
NewFieldModifier creates a new field modifier
func (*FieldModifier) Apply ¶
func (m *FieldModifier) Apply(env utils.Environment, assets flows.SessionAssets, contact *flows.Contact, log flows.EventCallback)
Apply applies this modification to the given contact
func (*FieldModifier) MarshalJSON ¶
func (m *FieldModifier) MarshalJSON() ([]byte, error)
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 GroupsModifier ¶
type GroupsModifier struct {
// contains filtered or unexported fields
}
GroupsModifier modifies the group membership of the contact
func NewGroupsModifier ¶
func NewGroupsModifier(groups []*flows.Group, modification GroupsModification) *GroupsModifier
NewGroupsModifier creates a new groups modifier
func (*GroupsModifier) Apply ¶
func (m *GroupsModifier) Apply(env utils.Environment, assets flows.SessionAssets, contact *flows.Contact, log flows.EventCallback)
Apply applies this modification to the given contact
func (*GroupsModifier) MarshalJSON ¶
func (m *GroupsModifier) MarshalJSON() ([]byte, error)
type LanguageModifier ¶
type LanguageModifier struct { Language utils.Language `json:"language"` // contains filtered or unexported fields }
LanguageModifier modifies the language of a contact
func NewLanguageModifier ¶
func NewLanguageModifier(language utils.Language) *LanguageModifier
NewLanguageModifier creates a new language modifier
func (*LanguageModifier) Apply ¶
func (m *LanguageModifier) Apply(env utils.Environment, assets flows.SessionAssets, contact *flows.Contact, log flows.EventCallback)
Apply applies this modification to the given contact
type NameModifier ¶
type NameModifier struct { Name string `json:"name"` // contains filtered or unexported fields }
NameModifier modifies the name of a contact
func NewNameModifier ¶
func NewNameModifier(name string) *NameModifier
NewNameModifier creates a new name modifier
func (*NameModifier) Apply ¶
func (m *NameModifier) Apply(env utils.Environment, assets flows.SessionAssets, contact *flows.Contact, log flows.EventCallback)
Apply applies this modification to the given contact
type TimezoneModifier ¶
type TimezoneModifier struct {
// contains filtered or unexported fields
}
TimezoneModifier modifies the timezone of a contact
func NewTimezoneModifier ¶
func NewTimezoneModifier(timezone *time.Location) *TimezoneModifier
NewTimezoneModifier creates a new timezone modifier
func (*TimezoneModifier) Apply ¶
func (m *TimezoneModifier) Apply(env utils.Environment, assets flows.SessionAssets, contact *flows.Contact, log flows.EventCallback)
Apply applies this modification to the given contact
func (*TimezoneModifier) MarshalJSON ¶
func (m *TimezoneModifier) MarshalJSON() ([]byte, error)
type URNModification ¶
type URNModification string
URNModification is the type of modification to make
const (
URNAppend URNModification = "append"
)
the supported types of modification
type URNModifier ¶
type URNModifier struct { URN urns.URN `json:"urn"` Modification URNModification `json:"modification" validate:"required,eq=append"` // contains filtered or unexported fields }
URNModifier modifies a URN on a contact
func NewURNModifier ¶
func NewURNModifier(urn urns.URN, modification URNModification) *URNModifier
NewURNModifier creates a new name modifier
func (*URNModifier) Apply ¶
func (m *URNModifier) Apply(env utils.Environment, assets flows.SessionAssets, contact *flows.Contact, log flows.EventCallback)
Apply applies this modification to the given contact