Documentation
¶
Index ¶
- Constants
- Variables
- func Context(env envs.Environment, contextable Contextable) types.XValue
- func ContextFunc(env envs.Environment, fn func(envs.Environment) map[string]types.XValue) *types.XObject
- func GroupReferences(groups []*Group) []*assets.GroupReference
- func LabelReferences(labels []*Label) []*assets.LabelReference
- func ValidateURN(fl validator.FieldLevel) bool
- func ValidateURNScheme(fl validator.FieldLevel) bool
- type AirtimeTransfer
- type Assets
- type BaseMsg
- type BroadcastTranslations
- type BroadcastUUID
- type Call
- type CallEnvelope
- type CallStatus
- type CallUUID
- type Campaign
- type CampaignAssets
- type Channel
- func (c *Channel) Asset() assets.Channel
- func (c *Channel) Context(env envs.Environment) map[string]types.XValue
- func (c *Channel) HasFeature(feat assets.ChannelFeature) bool
- func (c *Channel) HasRole(role assets.ChannelRole) bool
- func (c *Channel) Reference() *assets.ChannelReference
- func (c *Channel) String() string
- func (c *Channel) SupportsScheme(scheme string) bool
- type ChannelAssets
- type Contact
- func NewContact(sa Assets, uuid ContactUUID, id ContactID, name string, language i18n.Language, ...) (*Contact, error)
- func NewEmptyContact(sa Assets, name string, language i18n.Language, timezone *time.Location) *Contact
- func ReadContact(sa Assets, data []byte, missing assets.MissingCallback) (*Contact, error)
- func (c *Contact) AddRoute(urn urns.URN, channel *Channel) bool
- func (c *Contact) Clone() *Contact
- func (c *Contact) Context(env envs.Environment) map[string]types.XValue
- func (c *Contact) Country() i18n.Country
- func (c *Contact) CreatedOn() time.Time
- func (c *Contact) Fields() FieldValues
- func (c *Contact) Format(env envs.Environment) string
- func (c *Contact) Groups() *GroupList
- func (c *Contact) HasURN(urn urns.URN) bool
- func (c *Contact) ID() ContactID
- func (c *Contact) Language() i18n.Language
- func (c *Contact) LastSeenOn() *time.Time
- func (c *Contact) Locale(env envs.Environment) i18n.Locale
- func (c *Contact) Marshal() *ContactEnvelope
- func (c *Contact) MarshalJSON() ([]byte, error)
- func (c *Contact) Name() string
- func (c *Contact) PreferredChannel() *Channel
- func (c *Contact) PreferredURN() *URN
- func (c *Contact) QueryProperty(env envs.Environment, key string, propType contactql.PropertyType) []any
- func (c *Contact) ReevaluateQueryBasedGroups(env envs.Environment) ([]*Group, []*Group)
- func (c *Contact) Reference() *ContactReference
- func (c *Contact) RemoveURN(urn urns.URN) bool
- func (c *Contact) ResolveRoute() *Route
- func (c *Contact) SetAffinity(urn urns.URN, ch *Channel) bool
- func (c *Contact) SetLanguage(lang i18n.Language)
- func (c *Contact) SetLastSeenOn(t time.Time)
- func (c *Contact) SetName(name string)
- func (c *Contact) SetRoutes(routes []Route) bool
- func (c *Contact) SetStatus(status ContactStatus)
- func (c *Contact) SetTimezone(tz *time.Location)
- func (c *Contact) Status() ContactStatus
- func (c *Contact) Tickets() *TicketList
- func (c *Contact) Timezone() *time.Location
- func (c *Contact) URNs() URNList
- func (c *Contact) UUID() ContactUUID
- func (c *Contact) UpdatePreferredChannel(channel *Channel) bool
- type ContactEnvelope
- type ContactID
- type ContactReference
- type ContactStatus
- type ContactUUID
- type Contextable
- type Dial
- type DialStatus
- type Field
- type FieldAssets
- func (s *FieldAssets) All() []*Field
- func (s *FieldAssets) FirstOfType(valueType assets.FieldType) *Field
- func (s *FieldAssets) Get(key string) *Field
- func (s *FieldAssets) ResolveField(key string) assets.Field
- func (s *FieldAssets) ResolveFlow(name string) assets.Flow
- func (s *FieldAssets) ResolveGroup(name string) assets.Group
- type FieldValue
- type FieldValues
- func (f FieldValues) Clone() FieldValues
- func (f FieldValues) Context(env envs.Environment) map[string]types.XValue
- func (f FieldValues) Get(field *Field) *Value
- func (f FieldValues) Parse(env envs.Environment, fields *FieldAssets, field *Field, rawValue string) *Value
- func (f FieldValues) Set(field *Field, value *Value)
- type Global
- type GlobalAssets
- type Group
- type GroupAssets
- type GroupList
- func (l *GroupList) Add(group *Group) bool
- func (l *GroupList) All() []*Group
- func (l *GroupList) Clear()
- func (l *GroupList) Clone() *GroupList
- func (l *GroupList) Count() int
- func (l *GroupList) FindByUUID(uuid assets.GroupUUID) *Group
- func (l *GroupList) References() []*assets.GroupReference
- func (l *GroupList) Remove(group *Group) bool
- func (l *GroupList) ToXValue(env envs.Environment) types.XValue
- type HTTPLog
- type HTTPLogCallback
- type HTTPLogStatusResolver
- type HTTPLogWithoutTime
- type HTTPLogger
- type InputUUID
- type LLM
- type LLMAssets
- type LLMResponse
- type Label
- type LabelAssets
- type LocationAssets
- func (s *LocationAssets) FindLocations(env envs.Environment, name string, level envs.LocationLevel, ...) []*envs.Location
- func (s *LocationAssets) FindLocationsFuzzy(env envs.Environment, text string, level envs.LocationLevel, ...) []*envs.Location
- func (s *LocationAssets) LookupLocation(path envs.LocationPath) *envs.Location
- type MsgContent
- type MsgIn
- type MsgOut
- type MsgTemplating
- type NodeUUID
- type OptIn
- type OptInAssets
- type QuickReply
- type Resthook
- type ResthookAssets
- type Result
- type Route
- type RunStatus
- type RunUUID
- type SessionHistory
- type SessionUUID
- type Template
- type TemplateAssets
- type TemplateTranslation
- type TemplatingComponent
- type TemplatingVariable
- type Ticket
- func (t *Ticket) Assignee() *User
- func (t *Ticket) Context(env envs.Environment) map[string]types.XValue
- func (t *Ticket) Marshal() *TicketEnvelope
- func (t *Ticket) SetAssignee(user *User)
- func (t *Ticket) SetStatus(status TicketStatus)
- func (t *Ticket) SetTopic(topic *Topic)
- func (t *Ticket) Status() TicketStatus
- func (t *Ticket) Topic() *Topic
- func (t *Ticket) UUID() TicketUUID
- type TicketEnvelope
- type TicketList
- func (l *TicketList) Add(t *Ticket)
- func (l *TicketList) All() []*Ticket
- func (l *TicketList) Count() int
- func (l *TicketList) Find(uuid TicketUUID) *Ticket
- func (l *TicketList) LastOpen() *Ticket
- func (l *TicketList) Marshal() []*TicketEnvelope
- func (l *TicketList) Open() *TicketList
- func (l *TicketList) ToXValue(env envs.Environment) types.XValue
- type TicketStatus
- type TicketUUID
- type Topic
- type TopicAssets
- type URN
- type URNList
- func (l URNList) Clone() URNList
- func (l URNList) Encode() []urns.URN
- func (l URNList) Equal(other URNList) bool
- func (l URNList) MapContext(env envs.Environment) map[string]types.XValue
- func (l URNList) ToXValue(env envs.Environment) types.XValue
- func (l URNList) WithScheme(schemes ...string) URNList
- type UnsendableReason
- type User
- type UserAssets
- type Value
Constants ¶
const ( LocationLevelState = envs.LocationLevel(1) LocationLevelDistrict = envs.LocationLevel(2) LocationLevelWard = envs.LocationLevel(3) )
location levels which can be field types
const ( // max length of a message attachment (type:url) MaxAttachmentLength = 2048 // max length of a quick reply MaxQuickReplyTextLength = 64 MaxQuickReplyExtraLength = 1000 UnsendableReasonNoRoute UnsendableReason = "no_route" // no sendable channel+URN pair UnsendableReasonContactBlocked UnsendableReason = "contact_blocked" // contact is blocked UnsendableReasonContactStopped UnsendableReason = "contact_stopped" // contact is stopped UnsendableReasonContactArchived UnsendableReason = "contact_archived" // contact is archived )
const MaxContactURNs = 50
MaxContactURNs is maximum number of URNs a contact can have
const RedactionMask = "****************"
RedactionMask is the redaction mask for HTTP service logs
Variables ¶
var EmptyHistory = &SessionHistory{}
EmptyHistory is used for a session which has no history
Functions ¶
func Context ¶ added in v0.279.0
func Context(env envs.Environment, contextable Contextable) types.XValue
Context generates a lazy object for use in expressions
func ContextFunc ¶ added in v0.279.0
func ContextFunc(env envs.Environment, fn func(envs.Environment) map[string]types.XValue) *types.XObject
ContextFunc generates a lazy object for use in expressions
func GroupReferences ¶ added in v0.280.0
func GroupReferences(groups []*Group) []*assets.GroupReference
GroupReferences converts a slice of groups to a slice of references
func LabelReferences ¶ added in v0.280.0
func LabelReferences(labels []*Label) []*assets.LabelReference
LabelReferences converts a slice of labels to a slice of references
func ValidateURN ¶ added in v0.279.0
func ValidateURN(fl validator.FieldLevel) bool
ValidateURN validates whether the field value is a valid URN
func ValidateURNScheme ¶ added in v0.279.0
func ValidateURNScheme(fl validator.FieldLevel) bool
ValidateURNScheme validates whether the field value is a valid URN scheme
Types ¶
type AirtimeTransfer ¶
type AirtimeTransfer struct {
ExternalID string // provider transaction id, when known after initiation
Sender urns.URN
Recipient urns.URN
Currency string
Amount decimal.Decimal
}
AirtimeTransfer is the result of an attempted airtime transfer
type Assets ¶ added in v0.280.0
type Assets interface {
Campaigns() *CampaignAssets
Channels() *ChannelAssets
Fields() *FieldAssets
Globals() *GlobalAssets
Groups() *GroupAssets
Labels() *LabelAssets
LLMs() *LLMAssets
Locations() *LocationAssets
OptIns() *OptInAssets
Resthooks() *ResthookAssets
Templates() *TemplateAssets
Topics() *TopicAssets
Users() *UserAssets
}
Assets provides access to the asset types used by the domain model. The flow engine extends this with access to flow definitions as flows.SessionAssets.
type BaseMsg ¶
type BaseMsg struct {
URN_ urns.URN `json:"urn,omitempty" validate:"omitempty,urn"`
Channel_ *assets.ChannelReference `json:"channel,omitempty"`
Text_ string `json:"text"`
Attachments_ []utils.Attachment `json:"attachments,omitempty"`
}
BaseMsg represents a incoming or outgoing message with the session contact
func (*BaseMsg) Attachments ¶
func (m *BaseMsg) Attachments() []utils.Attachment
Attachments returns the attachments of this message
func (*BaseMsg) Channel ¶
func (m *BaseMsg) Channel() *assets.ChannelReference
Channel returns the channel of this message
type BroadcastTranslations ¶
type BroadcastTranslations map[i18n.Language]*MsgContent
func (BroadcastTranslations) ForContact ¶ added in v0.280.0
func (b BroadcastTranslations) ForContact(e envs.Environment, c *Contact, baseLanguage i18n.Language) (*MsgContent, i18n.Locale)
ForContact is a utility to help callers select the translation for a contact
type BroadcastUUID ¶
func NewBroadcastUUID ¶
func NewBroadcastUUID() BroadcastUUID
type Call ¶ added in v0.279.0
type Call struct {
// contains filtered or unexported fields
}
Call represents a call over a specific channel and URN
func (*Call) Marshal ¶ added in v0.279.0
func (c *Call) Marshal() *CallEnvelope
Marshal marshals a call into an envelope.
type CallEnvelope ¶
type CallEnvelope struct {
UUID CallUUID `json:"uuid" validate:"required,uuid"`
Channel *assets.ChannelReference `json:"channel" validate:"required"`
URN urns.URN `json:"urn" validate:"required,urn"`
}
CallEnvelope is the serialized form of a call. Use its Unmarshal method to resolve it against assets into a live call.
func (*CallEnvelope) Unmarshal ¶ added in v0.279.0
func (e *CallEnvelope) Unmarshal(channels *ChannelAssets, missing assets.MissingCallback) *Call
Unmarshal resolves this envelope into a live call.
type CallStatus ¶
type CallStatus string
CallStatus represents the status of a call to an external service
const ( // CallStatusSuccess represents that the webhook was successful CallStatusSuccess CallStatus = "success" // CallStatusConnectionError represents that the webhook had a connection error CallStatusConnectionError CallStatus = "connection_error" // CallStatusResponseError represents that the webhook response had a non 2xx status code CallStatusResponseError CallStatus = "response_error" // CallStatusSubscriberGone represents a special state of resthook responses which indicate the caller must remove that subscriber CallStatusSubscriberGone CallStatus = "subscriber_gone" )
func HTTPStatusFromCode ¶
func HTTPStatusFromCode(t *httpx.Trace) CallStatus
HTTPStatusFromCode uses the status code to determine status of an HTTP log
type Campaign ¶ added in v0.279.0
Campaign adds some functionality to campaign assets.
func NewCampaign ¶ added in v0.279.0
NewCampaign returns a new campaign object from the given campaign asset
func (*Campaign) Context ¶ added in v0.279.0
Context returns the properties available in expressions
uuid:text -> the UUID of the campaign name:text -> the name of the campaign
@context campaign
func (*Campaign) Reference ¶ added in v0.279.0
func (c *Campaign) Reference() *assets.CampaignReference
Reference returns a reference to this campaign
type CampaignAssets ¶ added in v0.279.0
type CampaignAssets struct {
// contains filtered or unexported fields
}
CampaignAssets provides access to all campaign assets
func NewCampaignAssets ¶ added in v0.279.0
func NewCampaignAssets(campaigns []assets.Campaign) *CampaignAssets
NewCampaignAssets creates a new set of campaign assets
func (*CampaignAssets) Get ¶ added in v0.279.0
func (s *CampaignAssets) Get(uuid assets.CampaignUUID) *Campaign
Get finds the campaign with the given UUID
type Channel ¶ added in v0.279.0
Channel represents a means for sending and receiving input during a flow run
func NewChannel ¶ added in v0.279.0
NewChannel creates a new channenl
func (*Channel) Context ¶ added in v0.279.0
Context returns the properties available in expressions
__default__:text -> the name uuid:text -> the UUID of the channel name:text -> the name of the channel address:text -> the address of the channel
@context channel
func (*Channel) HasFeature ¶ added in v0.279.0
func (c *Channel) HasFeature(feat assets.ChannelFeature) bool
HasFeature returns whether this channel has the given feature
func (*Channel) HasRole ¶ added in v0.279.0
func (c *Channel) HasRole(role assets.ChannelRole) bool
HasRole returns whether this channel has the given role
func (*Channel) Reference ¶ added in v0.279.0
func (c *Channel) Reference() *assets.ChannelReference
Reference returns a reference to this channel
func (*Channel) SupportsScheme ¶ added in v0.279.0
SupportsScheme returns whether this channel supports the given URN scheme
type ChannelAssets ¶ added in v0.279.0
type ChannelAssets struct {
// contains filtered or unexported fields
}
ChannelAssets provides access to all channel assets
func NewChannelAssets ¶ added in v0.279.0
func NewChannelAssets(channels []assets.Channel) *ChannelAssets
NewChannelAssets creates a new set of channel assets
func (*ChannelAssets) Get ¶ added in v0.279.0
func (s *ChannelAssets) Get(uuid assets.ChannelUUID) *Channel
Get returns the channel with the given UUID
func (*ChannelAssets) GetForURN ¶ added in v0.279.0
func (s *ChannelAssets) GetForURN(urn *URN, role assets.ChannelRole) *Channel
GetForURN returns the best channel for the given URN
type Contact ¶ added in v0.280.0
type Contact struct {
// contains filtered or unexported fields
}
Contact represents a person who is interacting with the flow
func NewContact ¶ added in v0.280.0
func NewContact( sa Assets, uuid ContactUUID, id ContactID, name string, language i18n.Language, status ContactStatus, timezone *time.Location, createdOn time.Time, lastSeenOn *time.Time, urns []urns.URN, groups []*assets.GroupReference, fields map[string]*Value, tickets []*Ticket, missing assets.MissingCallback) (*Contact, error)
NewContact creates a new contact with the passed in attributes
func NewEmptyContact ¶ added in v0.280.0
func NewEmptyContact(sa Assets, name string, language i18n.Language, timezone *time.Location) *Contact
NewEmptyContact creates a new empy contact with the passed in name, language and location
func ReadContact ¶ added in v0.280.0
ReadContact decodes a contact from the passed in JSON
func (*Contact) AddRoute ¶ added in v0.280.0
AddRoute adds a new URN to this contact with optional channel affinity. Returns whether the contact was changed. If the URN is already on the contact this is a no-op - to update channel affinity use SetAffinity or SetRoutes.
func (*Contact) Clone ¶ added in v0.280.0
Clone clones this contact when we need to snapshot as part of parent run summary.
func (*Contact) Context ¶ added in v0.280.0
Context returns the properties available in expressions
__default__:text -> the name or URN uuid:text -> the UUID of the contact ref:text -> the reference identifier of the contact first_name:text -> the first name of the contact name:text -> the name of the contact language:text -> the language of the contact as 3-letter ISO code status:text -> the status of the contact created_on:datetime -> the creation date of the contact last_seen_on:any -> the last seen date of the contact urns:[]text -> the URNs belonging to the contact urn:text -> the preferred URN of the contact groups:[]group -> the groups the contact belongs to fields:fields -> the custom field values of the contact channel:channel -> the preferred channel of the contact
@context contact
func (*Contact) Country ¶ added in v0.280.0
Country gets the country for this contact..
TODO: currently this is derived from their preferred channel or any tel URNs but probably should become an explicit field at some point
func (*Contact) Fields ¶ added in v0.280.0
func (c *Contact) Fields() FieldValues
Fields returns this contact's field values
func (*Contact) Format ¶ added in v0.280.0
func (c *Contact) Format(env envs.Environment) string
Format returns a friendly string version of this contact depending on what fields are set
func (*Contact) LastSeenOn ¶ added in v0.280.0
LastSeenOn returns the last seen on time of this contact
func (*Contact) Locale ¶ added in v0.280.0
func (c *Contact) Locale(env envs.Environment) i18n.Locale
Locale gets the locale for this contact, using the environment country if contact doesn't have one
func (*Contact) Marshal ¶ added in v0.280.0
func (c *Contact) Marshal() *ContactEnvelope
func (*Contact) MarshalJSON ¶ added in v0.280.0
MarshalJSON marshals this contact into JSON
func (*Contact) PreferredChannel ¶ added in v0.280.0
PreferredChannel gets the preferred channel for this contact, i.e. the channel we would use for sending
func (*Contact) PreferredURN ¶ added in v0.280.0
PreferredURN gets the preferred URN for this contact, i.e. the URN we would use for sending
func (*Contact) QueryProperty ¶ added in v0.280.0
func (c *Contact) QueryProperty(env envs.Environment, key string, propType contactql.PropertyType) []any
QueryProperty resolves a contact query search key for this contact
Note that this method excludes id, ref, group and flow search attributes as those are disallowed query based groups.
func (*Contact) ReevaluateQueryBasedGroups ¶ added in v0.280.0
func (c *Contact) ReevaluateQueryBasedGroups(env envs.Environment) ([]*Group, []*Group)
ReevaluateQueryBasedGroups reevaluates membership of all query based groups for this contact
func (*Contact) Reference ¶ added in v0.280.0
func (c *Contact) Reference() *ContactReference
Reference returns a reference to this contact
func (*Contact) ResolveRoute ¶ added in v0.282.0
ResolveRoute resolves the first sendable URN/channel route for this contact, or nil if there is none
func (*Contact) SetAffinity ¶ added in v0.280.0
SetAffinity sets the preferred URN/channel for this contact by moving it to the front of the list and returns whether any change was made. If the URN is not already associated with the contact then this is a no-op and returns false.
func (*Contact) SetLanguage ¶ added in v0.280.0
SetLanguage sets the language for this contact
func (*Contact) SetLastSeenOn ¶ added in v0.280.0
SetLastSeenOn sets the last seen on time of this contact
func (*Contact) SetRoutes ¶ added in v0.280.0
SetRoutes replaces this contact's URNs with the given routes, each carrying optional channel affinity.
func (*Contact) SetStatus ¶ added in v0.280.0
func (c *Contact) SetStatus(status ContactStatus)
SetStatus sets the status of this contact (blocked, stopped or active)
func (*Contact) SetTimezone ¶ added in v0.280.0
SetTimezone sets the timezone of this contact
func (*Contact) Status ¶ added in v0.280.0
func (c *Contact) Status() ContactStatus
Status returns the contact status
func (*Contact) Tickets ¶ added in v0.280.0
func (c *Contact) Tickets() *TicketList
Tickets returns the tickets for this contact
func (*Contact) UUID ¶ added in v0.280.0
func (c *Contact) UUID() ContactUUID
UUID returns the UUID of this contact
func (*Contact) UpdatePreferredChannel ¶ added in v0.280.0
UpdatePreferredChannel updates the preferred channel and returns whether any change was made
type ContactEnvelope ¶ added in v0.280.0
type ContactEnvelope struct {
UUID ContactUUID `json:"uuid" validate:"required,uuid"`
ID ContactID `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Language i18n.Language `json:"language,omitempty"`
Status ContactStatus `json:"status,omitempty" validate:"required,contact_status"`
Timezone string `json:"timezone,omitempty"`
CreatedOn time.Time `json:"created_on" validate:"required"`
LastSeenOn *time.Time `json:"last_seen_on,omitempty"`
URNs []urns.URN `json:"urns,omitempty" validate:"dive,urn"`
Groups []*assets.GroupReference `json:"groups,omitempty" validate:"dive"`
Fields map[string]*Value `json:"fields,omitempty"`
Tickets []*TicketEnvelope `json:"tickets,omitempty"`
}
func (*ContactEnvelope) Unmarshal ¶ added in v0.280.0
func (e *ContactEnvelope) Unmarshal(sa Assets, missing assets.MissingCallback) (*Contact, error)
type ContactReference ¶
type ContactReference struct {
UUID ContactUUID `json:"uuid" validate:"required,uuid"`
Name string `json:"name" validate:"max=128"`
}
ContactReference is used to reference a contact
func NewContactReference ¶
func NewContactReference(uuid ContactUUID, name string) *ContactReference
NewContactReference creates a new contact reference with the given UUID and name
func (*ContactReference) Identity ¶
func (r *ContactReference) Identity() string
Identity returns the unique identity of the asset
func (*ContactReference) String ¶
func (r *ContactReference) String() string
func (*ContactReference) Type ¶
func (r *ContactReference) Type() string
Type returns the name of the asset type
func (*ContactReference) Variable ¶
func (r *ContactReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type ContactStatus ¶
type ContactStatus string
ContactStatus is status in which a contact is in
const ( // ContactStatusActive is the contact status of active ContactStatusActive ContactStatus = "active" // ContactStatusBlocked is the contact status of blocked ContactStatusBlocked ContactStatus = "blocked" // ContactStatusStopped is the contact status of stopped ContactStatusStopped ContactStatus = "stopped" // ContactStatusArchived is the contact status of archived ContactStatusArchived ContactStatus = "archived" )
type ContactUUID ¶
ContactUUID is the UUID of a contact
func NewContactUUID ¶
func NewContactUUID() ContactUUID
NewContactUUID generates a new UUID for a contact
type Contextable ¶ added in v0.279.0
type Contextable interface {
Context(env envs.Environment) map[string]types.XValue
}
Contextable is an object that can accessed in expressions as a object with properties
type Dial ¶
type Dial struct {
Status DialStatus `json:"status" validate:"required,dial_status"`
Duration int `json:"duration"`
}
Dial represents a dialed call or attempt to dial a phone number
type DialStatus ¶
type DialStatus string
DialStatus is the type for different dial statuses
const ( DialStatusAnswered DialStatus = "answered" DialStatusNoAnswer DialStatus = "no_answer" DialStatusBusy DialStatus = "busy" DialStatusFailed DialStatus = "failed" )
possible dial status values
type Field ¶ added in v0.280.0
Field represents a contact field
func (*Field) Reference ¶ added in v0.280.0
func (f *Field) Reference() *assets.FieldReference
Reference returns a reference to this field
type FieldAssets ¶ added in v0.280.0
type FieldAssets struct {
// contains filtered or unexported fields
}
FieldAssets provides access to all field assets
func NewFieldAssets ¶ added in v0.280.0
func NewFieldAssets(fields []assets.Field) *FieldAssets
NewFieldAssets creates a new set of field assets
func (*FieldAssets) All ¶ added in v0.280.0
func (s *FieldAssets) All() []*Field
All returns all the fields in this set
func (*FieldAssets) FirstOfType ¶ added in v0.280.0
func (s *FieldAssets) FirstOfType(valueType assets.FieldType) *Field
FirstOfType returns the first field in this set with the given value type
func (*FieldAssets) Get ¶ added in v0.280.0
func (s *FieldAssets) Get(key string) *Field
Get returns the contact field with the given key
func (*FieldAssets) ResolveField ¶ added in v0.280.0
func (s *FieldAssets) ResolveField(key string) assets.Field
func (*FieldAssets) ResolveFlow ¶ added in v0.280.0
func (s *FieldAssets) ResolveFlow(name string) assets.Flow
func (*FieldAssets) ResolveGroup ¶ added in v0.280.0
func (s *FieldAssets) ResolveGroup(name string) assets.Group
type FieldValue ¶ added in v0.280.0
type FieldValue struct {
*Value
// contains filtered or unexported fields
}
FieldValue represents a field and a set of values for that field
func NewFieldValue ¶ added in v0.280.0
func NewFieldValue(field *Field, value *Value) *FieldValue
NewFieldValue creates a new field value
func (*FieldValue) Field ¶ added in v0.280.0
func (v *FieldValue) Field() *Field
Field returns the field this value is for
func (*FieldValue) QueryValue ¶ added in v0.280.0
func (v *FieldValue) QueryValue() any
QueryValue returns the value for use in contact queries
func (*FieldValue) ToXValue ¶ added in v0.280.0
func (v *FieldValue) ToXValue(env envs.Environment) types.XValue
ToXValue returns a representation of this object for use in expressions
type FieldValues ¶ added in v0.280.0
type FieldValues map[string]*FieldValue
FieldValues is the set of all field values for a contact
func NewFieldValues ¶ added in v0.280.0
func NewFieldValues(fields *FieldAssets, values map[string]*Value, missing assets.MissingCallback) FieldValues
NewFieldValues creates a new field value map
func (FieldValues) Clone ¶ added in v0.280.0
func (f FieldValues) Clone() FieldValues
Clone returns a clone of this set of field values
func (FieldValues) Context ¶ added in v0.280.0
func (f FieldValues) Context(env envs.Environment) map[string]types.XValue
Context returns the properties available in expressions
func (FieldValues) Get ¶ added in v0.280.0
func (f FieldValues) Get(field *Field) *Value
Get gets the value set for the given field
func (FieldValues) Parse ¶ added in v0.280.0
func (f FieldValues) Parse(env envs.Environment, fields *FieldAssets, field *Field, rawValue string) *Value
Parse parses a raw string field value into the different possible types
func (FieldValues) Set ¶ added in v0.280.0
func (f FieldValues) Set(field *Field, value *Value)
Set sets the value for the given field (can be null to clear it)
type Global ¶ added in v0.280.0
Global represents a constant value available in expressions.
func NewGlobal ¶ added in v0.280.0
NewGlobal returns a new global object from the given global asset
func (*Global) Reference ¶ added in v0.280.0
func (g *Global) Reference() *assets.GlobalReference
Reference returns a reference to this global
type GlobalAssets ¶ added in v0.280.0
type GlobalAssets struct {
// contains filtered or unexported fields
}
GlobalAssets provides access to all global assets
func NewGlobalAssets ¶ added in v0.280.0
func NewGlobalAssets(globals []assets.Global) *GlobalAssets
NewGlobalAssets creates a new set of global assets
func (*GlobalAssets) Context ¶ added in v0.280.0
func (s *GlobalAssets) Context(env envs.Environment) map[string]types.XValue
Context returns the properties available in expressions
func (*GlobalAssets) Get ¶ added in v0.280.0
func (s *GlobalAssets) Get(key string) *Global
Get returns the global with the given key
type Group ¶ added in v0.280.0
Group adds some functionality to group assets.
func NewGroup ¶ added in v0.280.0
func NewGroup(asset assets.Group, query *contactql.ContactQuery) *Group
NewGroup returns a new group object from the given group asset and - if it's query based - its parsed query. Parsing is the caller's responsibility so that this package doesn't depend on query parsing.
func (*Group) CheckQueryBasedMembership ¶ added in v0.280.0
func (g *Group) CheckQueryBasedMembership(env envs.Environment, contact *Contact) bool
CheckQueryBasedMembership returns whether the given contact belongs in a query based group
func (*Group) Reference ¶ added in v0.280.0
func (g *Group) Reference() *assets.GroupReference
Reference returns a reference to this group
type GroupAssets ¶ added in v0.280.0
type GroupAssets struct {
// contains filtered or unexported fields
}
GroupAssets provides access to all group assets
func NewGroupAssets ¶ added in v0.280.0
func NewGroupAssets(groups []*Group) *GroupAssets
NewGroupAssets creates a new set of group assets
func (*GroupAssets) All ¶ added in v0.280.0
func (s *GroupAssets) All() []*Group
All returns all the groups
func (*GroupAssets) FindByName ¶ added in v0.280.0
func (s *GroupAssets) FindByName(name string) *Group
FindByName looks for a group with the given name (case-insensitive)
type GroupList ¶ added in v0.280.0
type GroupList struct {
// contains filtered or unexported fields
}
GroupList defines a contact's list of groups
func NewGroupList ¶ added in v0.280.0
func NewGroupList(groupAssets *GroupAssets, refs []*assets.GroupReference, missing assets.MissingCallback) *GroupList
NewGroupList creates a new group list
func (*GroupList) Clear ¶ added in v0.280.0
func (l *GroupList) Clear()
Clear clears this group list
func (*GroupList) FindByUUID ¶ added in v0.280.0
FindByUUID returns the group with the passed in UUID or nil if not found
func (*GroupList) References ¶ added in v0.280.0
func (l *GroupList) References() []*assets.GroupReference
References returns this group list as a slice of group references
type HTTPLog ¶
type HTTPLog struct {
*HTTPLogWithoutTime
CreatedOn time.Time `json:"created_on" validate:"required"`
}
HTTPLog describes an HTTP request/response
func NewHTTPLog ¶
func NewHTTPLog(trace *httpx.Trace, statusFn HTTPLogStatusResolver, redact stringsx.Redactor) *HTTPLog
NewHTTPLog creates a new HTTP log from a trace
type HTTPLogCallback ¶
type HTTPLogCallback func(*HTTPLog)
HTTPLogCallback is a function that handles an HTTP log
type HTTPLogStatusResolver ¶
type HTTPLogStatusResolver func(t *httpx.Trace) CallStatus
HTTPLogStatusResolver is a function that determines the status of an HTTP log from the response
type HTTPLogWithoutTime ¶
type HTTPLogWithoutTime struct {
*httpx.LogWithoutTime
Status CallStatus `json:"status" validate:"required"`
}
HTTPLogWithoutTime is an HTTP log no time and status added - used for webhook events which already encode the time
func NewHTTPLogWithoutTime ¶
func NewHTTPLogWithoutTime(trace *httpx.Trace, status CallStatus, redact stringsx.Redactor) *HTTPLogWithoutTime
NewHTTPLogWithoutTime creates a new HTTP log from a trace
type LLM ¶ added in v0.279.0
LLM represents a large language model.
func (*LLM) Reference ¶ added in v0.279.0
func (l *LLM) Reference() *assets.LLMReference
Reference returns a reference to this LLM
type LLMAssets ¶ added in v0.279.0
type LLMAssets struct {
// contains filtered or unexported fields
}
LLMAssets provides access to all LLM assets
func NewLLMAssets ¶ added in v0.279.0
NewLLMAssets creates a new set of LLM assets
type LLMResponse ¶
LLMResponse is the response from an LLM service call
type Label ¶ added in v0.280.0
Label represents a message label
func (*Label) Reference ¶ added in v0.280.0
func (l *Label) Reference() *assets.LabelReference
Reference returns a reference to this label
type LabelAssets ¶ added in v0.280.0
type LabelAssets struct {
// contains filtered or unexported fields
}
LabelAssets provides access to all label assets
func NewLabelAssets ¶ added in v0.280.0
func NewLabelAssets(labels []assets.Label) *LabelAssets
NewLabelAssets creates a new set of label assets
func (*LabelAssets) All ¶ added in v0.280.0
func (s *LabelAssets) All() []*Label
All returns all the labels
func (*LabelAssets) FindByName ¶ added in v0.280.0
func (s *LabelAssets) FindByName(name string) *Label
FindByName looks for a label with the given name (case-insensitive)
type LocationAssets ¶ added in v0.280.0
type LocationAssets struct {
// contains filtered or unexported fields
}
LocationAssets provides access to location assets and implements envs.LocationResolver
func NewLocationAssets ¶ added in v0.280.0
func NewLocationAssets(hierarchies []assets.LocationHierarchy) *LocationAssets
NewLocationAssets creates a new set of location assets
func (*LocationAssets) FindLocations ¶ added in v0.280.0
func (s *LocationAssets) FindLocations(env envs.Environment, name string, level envs.LocationLevel, parent *envs.Location) []*envs.Location
FindLocations returns locations with the matching name (case-insensitive), level and parent (optional)
func (*LocationAssets) FindLocationsFuzzy ¶ added in v0.280.0
func (s *LocationAssets) FindLocationsFuzzy(env envs.Environment, text string, level envs.LocationLevel, parent *envs.Location) []*envs.Location
FindLocationsFuzzy returns matching locations like FindLocations but attempts the following strategies to find locations:
- Exact match
- Match with punctuation removed
- Split input into words and try to match each word
- Try to match pairs of words
func (*LocationAssets) LookupLocation ¶ added in v0.280.0
func (s *LocationAssets) LookupLocation(path envs.LocationPath) *envs.Location
type MsgContent ¶
type MsgContent struct {
Text string `json:"text"`
Attachments []utils.Attachment `json:"attachments,omitempty"`
QuickReplies []QuickReply `json:"quick_replies,omitempty"`
}
MsgContent is message content in a particular language
func (*MsgContent) Empty ¶
func (c *MsgContent) Empty() bool
type MsgIn ¶
type MsgIn struct {
BaseMsg
ExternalID_ string `json:"external_id,omitempty"`
Payload_ json.RawMessage `json:"payload,omitempty"`
}
MsgIn represents a incoming message from the session contact
func NewMsgIn ¶
func NewMsgIn(urn urns.URN, channel *assets.ChannelReference, text string, attachments []utils.Attachment, externalID string, payload json.RawMessage) *MsgIn
NewMsgIn creates a new incoming message
func (*MsgIn) ExternalID ¶
ExternalID returns the optional external ID of this incoming message
func (*MsgIn) Payload ¶ added in v0.286.0
func (m *MsgIn) Payload() json.RawMessage
Payload returns the optional structured data of this incoming message, e.g. a form submission
type MsgOut ¶
type MsgOut struct {
BaseMsg
QuickReplies_ []QuickReply `json:"quick_replies,omitempty"`
Templating_ *MsgTemplating `json:"templating,omitempty"`
Locale_ i18n.Locale `json:"locale,omitempty"`
UnsendableReason_ UnsendableReason `json:"unsendable_reason,omitempty"`
}
MsgOut represents a outgoing message to the session contact
func NewIVRMsgOut ¶
func NewIVRMsgOut(urn urns.URN, channel *assets.ChannelReference, text string, audioURL string, locale i18n.Locale) *MsgOut
NewIVRMsgOut creates a new outgoing message for IVR
func NewMsgOut ¶
func NewMsgOut(urn urns.URN, channel *assets.ChannelReference, content *MsgContent, templating *MsgTemplating, locale i18n.Locale, reason UnsendableReason) *MsgOut
NewMsgOut creates a new outgoing message
func (*MsgOut) QuickReplies ¶
func (m *MsgOut) QuickReplies() []QuickReply
QuickReplies returns the quick replies of this outgoing message
func (*MsgOut) Templating ¶
func (m *MsgOut) Templating() *MsgTemplating
Templating returns the templating to use to send this message (if any)
func (*MsgOut) UnsendableReason ¶
func (m *MsgOut) UnsendableReason() UnsendableReason
UnsendableReason returns the reason this message can't be sent (if any)
type MsgTemplating ¶
type MsgTemplating struct {
Template *assets.TemplateReference `json:"template"`
Components []*TemplatingComponent `json:"components,omitempty"`
Variables []*TemplatingVariable `json:"variables,omitempty"`
}
MsgTemplating represents any substituted message template that should be applied when sending this message
func NewMsgTemplating ¶
func NewMsgTemplating(template *assets.TemplateReference, components []*TemplatingComponent, variables []*TemplatingVariable) *MsgTemplating
NewMsgTemplating creates and returns a new msg template
type NodeUUID ¶
NodeUUID is a UUID of a flow node
func NewNodeUUID ¶ added in v0.280.0
func NewNodeUUID() NodeUUID
NewNodeUUID generates a new UUID for a node
type OptIn ¶ added in v0.279.0
OptIn adds some functionality to optin assets.
func (*OptIn) Context ¶ added in v0.279.0
Context returns the properties available in expressions
uuid:text -> the UUID of the optin name:text -> the name of the optin
@context optin
func (*OptIn) Reference ¶ added in v0.279.0
func (o *OptIn) Reference() *assets.OptInReference
Reference returns a reference to this optin
type OptInAssets ¶ added in v0.279.0
type OptInAssets struct {
// contains filtered or unexported fields
}
OptInAssets provides access to all optin assets
func NewOptInAssets ¶ added in v0.279.0
func NewOptInAssets(optins []assets.OptIn) *OptInAssets
NewOptInAssets creates a new set of optin assets
type QuickReply ¶
type QuickReply struct {
Type string `json:"type"`
Text string `json:"text,omitempty"`
Extra string `json:"extra,omitempty"`
}
QuickReply is a suggested reply or action attached to an outgoing message. For type text, extra is an optional description, for type form, extra is the channel-specific ID of the form to be opened (e.g. a WhatsApp flow ID), and for type url, extra is the URL to be opened.
func (QuickReply) MarshalJSON ¶
func (q QuickReply) MarshalJSON() ([]byte, error)
func (QuickReply) MarshalText ¶
func (q QuickReply) MarshalText() (text []byte, err error)
MarshalText marshals a quick reply into a text representation using placeholders
func (*QuickReply) UnmarshalJSON ¶
func (q *QuickReply) UnmarshalJSON(d []byte) error
func (*QuickReply) UnmarshalText ¶
func (q *QuickReply) UnmarshalText(text []byte) error
type Resthook ¶ added in v0.280.0
Resthook represents a named event and a set of subscribers
func NewResthook ¶ added in v0.280.0
NewResthook returns a new resthook object
type ResthookAssets ¶ added in v0.280.0
type ResthookAssets struct {
// contains filtered or unexported fields
}
ResthookAssets provides access to all resthook assets
func NewResthookAssets ¶ added in v0.280.0
func NewResthookAssets(resthooks []assets.Resthook) *ResthookAssets
NewResthookAssets creates a new set of resthook assets
func (*ResthookAssets) FindBySlug ¶ added in v0.280.0
func (s *ResthookAssets) FindBySlug(slug string) *Resthook
FindBySlug finds the group with the given UUID
type Result ¶
type Result struct {
Name string `json:"name" validate:"required"` // TODO add result_name validation when we're sure sessions no longer have invalid result names
Value string `json:"value"`
Category string `json:"category,omitempty"`
CategoryLocalized string `json:"category_localized,omitempty"`
NodeUUID NodeUUID `json:"node_uuid"`
Input string `json:"input,omitempty"` // should be called operand but too late now
Extra json.RawMessage `json:"extra,omitempty"`
CreatedOn time.Time `json:"created_on" validate:"required"`
}
Result describes a value captured during a run's execution. It might have been implicitly created by a router, or explicitly created by a [set_run_result](#action:set_run_result) action.
func NewResult ¶
func NewResult(name string, value string, category string, categoryLocalized string, nodeUUID NodeUUID, input string, extra []byte, createdOn time.Time) *Result
NewResult creates a new result
func (*Result) Context ¶
Context returns the properties available in expressions
__default__:text -> the value name:text -> the name of the result value:text -> the value of the result category:text -> the category of the result category_localized:text -> the localized category of the result input:text -> the input of the result node_uuid:text -> the UUID of the node in the flow that generated the result created_on:datetime -> the creation date of the result
@context result
type RunStatus ¶
type RunStatus string
RunStatus represents the current status of the flow run
const ( // RunStatusActive represents a run that is still active RunStatusActive RunStatus = "active" // RunStatusCompleted represents a run that has run to completion RunStatusCompleted RunStatus = "completed" // RunStatusWaiting represents a run which is waiting for something from the caller RunStatusWaiting RunStatus = "waiting" // RunStatusFailed represents a run that encountered an unrecoverable error RunStatusFailed RunStatus = "failed" // RunStatusExpired represents a run that expired due to inactivity RunStatusExpired RunStatus = "expired" // RunStatusInterrupted is never used by the engine but callers may put runs into this state RunStatusInterrupted RunStatus = "interrupted" )
type SessionHistory ¶
type SessionHistory struct {
ParentUUID SessionUUID `json:"parent_uuid"`
Ancestors int `json:"ancestors"`
AncestorsSinceInput int `json:"ancestors_since_input"`
}
SessionHistory provides information about the sessions that caused this session
func (*SessionHistory) Advance ¶
func (h *SessionHistory) Advance(newParent SessionUUID, receivedInput bool) *SessionHistory
Advance moves history forward to a new parent
type SessionUUID ¶
SessionUUID is the UUID of a session
func NewSessionUUID ¶
func NewSessionUUID() SessionUUID
NewSessionUUID generates a new UUID for a session
type Template ¶ added in v0.280.0
Template represents messaging templates used by channels types such as WhatsApp
func NewTemplate ¶ added in v0.280.0
NewTemplate returns a new template objects based on the passed in asset
func (*Template) FindTranslation ¶ added in v0.280.0
func (t *Template) FindTranslation(channel *Channel, locales []i18n.Locale) *TemplateTranslation
FindTranslation finds the matching translation for the passed in channel and languages (in priority order)
func (*Template) Reference ¶ added in v0.280.0
func (t *Template) Reference() *assets.TemplateReference
Reference returns the reference for this template
func (*Template) Templating ¶ added in v0.280.0
func (t *Template) Templating(tt *TemplateTranslation, vars []string) *MsgTemplating
Templating generates a templating object for the passed in translation and variables
type TemplateAssets ¶ added in v0.280.0
type TemplateAssets struct {
// contains filtered or unexported fields
}
TemplateAssets is our type for all the templates in an environment
func NewTemplateAssets ¶ added in v0.280.0
func NewTemplateAssets(ts []assets.Template) *TemplateAssets
NewTemplateAssets creates a new template list
func (*TemplateAssets) Get ¶ added in v0.280.0
func (a *TemplateAssets) Get(uuid assets.TemplateUUID) *Template
Get returns the template with the passed in UUID if any
type TemplateTranslation ¶ added in v0.280.0
type TemplateTranslation struct {
assets.TemplateTranslation
}
TemplateTranslation represents a single translation for a template
func NewTemplateTranslation ¶ added in v0.280.0
func NewTemplateTranslation(t assets.TemplateTranslation) *TemplateTranslation
NewTemplateTranslation returns a new TemplateTranslation for the passed in asset
func (*TemplateTranslation) Asset ¶ added in v0.280.0
func (t *TemplateTranslation) Asset() assets.TemplateTranslation
Asset returns the underlying asset
func (*TemplateTranslation) Preview ¶ added in v0.280.0
func (t *TemplateTranslation) Preview(vars []*TemplatingVariable) *MsgContent
Preview returns message content which will act as a preview of a message sent with this template
type TemplatingComponent ¶
type TemplatingVariable ¶
type Ticket ¶ added in v0.279.0
type Ticket struct {
// contains filtered or unexported fields
}
Ticket is a ticket in a ticketing system
func NewTicket ¶ added in v0.279.0
func NewTicket(uuid TicketUUID, status TicketStatus, topic *Topic, assignee *User) *Ticket
NewTicket creates a new ticket
func OpenTicket ¶ added in v0.279.0
OpenTicket creates a new ticket. Used by ticketing services to open a new ticket.
func (*Ticket) Context ¶ added in v0.279.0
Context returns the properties available in expressions
uuid:text -> the UUID of the ticket topic:any -> the topic of the ticket assignee:any -> the assignee of the ticket
@context ticket
func (*Ticket) Marshal ¶ added in v0.279.0
func (t *Ticket) Marshal() *TicketEnvelope
Marshal marshals a ticket into an envelope.
func (*Ticket) SetAssignee ¶ added in v0.279.0
func (*Ticket) SetStatus ¶ added in v0.279.0
func (t *Ticket) SetStatus(status TicketStatus)
func (*Ticket) Status ¶ added in v0.279.0
func (t *Ticket) Status() TicketStatus
func (*Ticket) UUID ¶ added in v0.279.0
func (t *Ticket) UUID() TicketUUID
type TicketEnvelope ¶
type TicketEnvelope struct {
UUID TicketUUID `json:"uuid" validate:"required,uuid"`
Status TicketStatus `json:"status"` // TODO validate:"required,eq=open|eq=closed"`
Topic *assets.TopicReference `json:"topic" validate:"omitempty"`
Assignee *assets.UserReference `json:"assignee,omitempty" validate:"omitempty"`
}
TicketEnvelope is the serialized form of a ticket. Use its Unmarshal method to resolve it against assets into a live ticket.
func (*TicketEnvelope) Unmarshal ¶ added in v0.279.0
func (e *TicketEnvelope) Unmarshal(topics *TopicAssets, users *UserAssets, missing assets.MissingCallback) *Ticket
Unmarshal resolves this envelope into a live ticket. If the topic or assigned user can't be found in the assets, we report the missing asset and return ticket without those.
type TicketList ¶ added in v0.279.0
type TicketList struct {
// contains filtered or unexported fields
}
func NewTicketList ¶ added in v0.279.0
func NewTicketList(tickets []*Ticket) *TicketList
func (*TicketList) Add ¶ added in v0.279.0
func (l *TicketList) Add(t *Ticket)
func (*TicketList) All ¶ added in v0.279.0
func (l *TicketList) All() []*Ticket
func (*TicketList) Count ¶ added in v0.279.0
func (l *TicketList) Count() int
func (*TicketList) Find ¶ added in v0.279.0
func (l *TicketList) Find(uuid TicketUUID) *Ticket
func (*TicketList) LastOpen ¶ added in v0.279.0
func (l *TicketList) LastOpen() *Ticket
func (*TicketList) Marshal ¶ added in v0.279.0
func (l *TicketList) Marshal() []*TicketEnvelope
func (*TicketList) Open ¶ added in v0.279.0
func (l *TicketList) Open() *TicketList
func (*TicketList) ToXValue ¶ added in v0.279.0
func (l *TicketList) ToXValue(env envs.Environment) types.XValue
ToXValue returns a representation of this object for use in expressions
type TicketStatus ¶
type TicketStatus string
const ( // TicketStatusOpen is the status of an open ticket TicketStatusOpen TicketStatus = "open" // TicketStatusClosed is the status of a closed ticket TicketStatusClosed TicketStatus = "closed" )
type TicketUUID ¶
TicketUUID is the UUID of a ticket
func NewTicketUUID ¶
func NewTicketUUID() TicketUUID
NewTicketUUID generates a new UUID for a ticket
type Topic ¶ added in v0.279.0
Topic represents a ticket topic
func (*Topic) Context ¶ added in v0.279.0
Context returns the properties available in expressions
__default__:text -> the name uuid:text -> the UUID of the topic name:text -> the name of the topic
@context topic
func (*Topic) Reference ¶ added in v0.279.0
func (t *Topic) Reference() *assets.TopicReference
Reference returns a reference to this topic
type TopicAssets ¶ added in v0.279.0
type TopicAssets struct {
// contains filtered or unexported fields
}
TopicAssets provides access to all topic assets
func NewTopicAssets ¶ added in v0.279.0
func NewTopicAssets(topics []assets.Topic) *TopicAssets
NewTopicAssets creates a new set of topic assets
func (*TopicAssets) FindByName ¶ added in v0.279.0
func (s *TopicAssets) FindByName(name string) *Topic
FindByName looks for a topic with the given name (case-insensitive)
type URN ¶ added in v0.279.0
URN adds additional functionality around urns.URN such as channel affinity.
func ParseURN ¶ added in v0.279.0
func ParseURN(ca *ChannelAssets, encoded urns.URN, missing assets.MissingCallback) (*URN, error)
ParseURN converts an encoded urns.URN to a URN
type URNList ¶ added in v0.279.0
type URNList []*URN
URNList is the list of a contact's URNs
func NewURNList ¶ added in v0.279.0
func NewURNList(channels *ChannelAssets, encoded []urns.URN, missing assets.MissingCallback) (URNList, error)
func (URNList) Equal ¶ added in v0.279.0
Equal returns whether this list of URNs is equal to another
func (URNList) MapContext ¶ added in v0.279.0
MapContext returns a map of the highest priority URN for each scheme - exposed in expressions as @urns
func (URNList) ToXValue ¶ added in v0.279.0
func (l URNList) ToXValue(env envs.Environment) types.XValue
ToXValue returns a representation of this object for use in expressions
func (URNList) WithScheme ¶ added in v0.279.0
WithScheme returns a new URN list containing of only URNs of the given schemes
type UnsendableReason ¶
type UnsendableReason string
type User ¶ added in v0.279.0
User adds some functionality to user assets.
func (*User) Context ¶ added in v0.279.0
Context returns the properties available in expressions
__default__:text -> the name or email email:text -> the email address of the user name:text -> the name of the user first_name:text -> the first name of the user
@context user
func (*User) Format ¶ added in v0.279.0
Format returns a friendly string version of this user depending on what fields are set
func (*User) Reference ¶ added in v0.279.0
func (u *User) Reference() *assets.UserReference
Reference returns a reference to this user
type UserAssets ¶ added in v0.279.0
type UserAssets struct {
// contains filtered or unexported fields
}
UserAssets provides access to all user assets
func NewUserAssets ¶ added in v0.279.0
func NewUserAssets(users []assets.User) *UserAssets
NewUserAssets creates a new set of user assets
func (*UserAssets) FindByEmail ¶ added in v0.279.0
func (s *UserAssets) FindByEmail(email string) *User
FindByEmail looks for a user with the given email (case-insensitive)
type Value ¶
type Value struct {
Text *types.XText `json:"text" validate:"required"`
Datetime *types.XDateTime `json:"datetime,omitempty"`
Number *types.XNumber `json:"number,omitempty"`
State envs.LocationPath `json:"state,omitempty"`
District envs.LocationPath `json:"district,omitempty"`
Ward envs.LocationPath `json:"ward,omitempty"`
}
Value represents a value in each of the field types
func NewValue ¶
func NewValue(text *types.XText, datetime *types.XDateTime, number *types.XNumber, state envs.LocationPath, district envs.LocationPath, ward envs.LocationPath) *Value
NewValue creates an empty value