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

core

package
v0.289.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 25 Imported by: 30

Documentation

Index

Constants

View Source
const (
	LocationLevelState    = envs.LocationLevel(1)
	LocationLevelDistrict = envs.LocationLevel(2)
	LocationLevelWard     = envs.LocationLevel(3)
)

location levels which can be field types

View Source
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
)
View Source
const MaxContactURNs = 50

MaxContactURNs is maximum number of URNs a contact can have

View Source
const RedactionMask = "****************"

RedactionMask is the redaction mask for HTTP service logs

Variables

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

func (*BaseMsg) SetURN

func (m *BaseMsg) SetURN(urn urns.URN)

SetURN returns the URN of this message

func (*BaseMsg) Text

func (m *BaseMsg) Text() string

Text returns the text of this message

func (*BaseMsg) URN

func (m *BaseMsg) URN() urns.URN

URN returns the URN 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

type BroadcastUUID uuids.UUID

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 NewCall added in v0.279.0

func NewCall(uuid CallUUID, channel *Channel, urn urns.URN) *Call

NewCall creates a new call

func (*Call) Channel added in v0.279.0

func (c *Call) Channel() *Channel

func (*Call) Marshal added in v0.279.0

func (c *Call) Marshal() *CallEnvelope

Marshal marshals a call into an envelope.

func (*Call) URN added in v0.279.0

func (c *Call) URN() urns.URN

func (*Call) UUID added in v0.279.0

func (c *Call) UUID() CallUUID

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 CallUUID

type CallUUID uuids.UUID

CallUUID is the UUID of a call

func NewCallUUID

func NewCallUUID() CallUUID

NewCallUUID generates a new UUID for a call

type Campaign added in v0.279.0

type Campaign struct {
	assets.Campaign
}

Campaign adds some functionality to campaign assets.

func NewCampaign added in v0.279.0

func NewCampaign(asset assets.Campaign) *Campaign

NewCampaign returns a new campaign object from the given campaign asset

func (*Campaign) Asset added in v0.279.0

func (c *Campaign) Asset() assets.Campaign

Asset returns the underlying asset

func (*Campaign) Context added in v0.279.0

func (c *Campaign) Context(env envs.Environment) map[string]types.XValue

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

Get finds the campaign with the given UUID

type Channel added in v0.279.0

type Channel struct {
	assets.Channel
}

Channel represents a means for sending and receiving input during a flow run

func NewChannel added in v0.279.0

func NewChannel(asset assets.Channel) *Channel

NewChannel creates a new channenl

func (*Channel) Asset added in v0.279.0

func (c *Channel) Asset() assets.Channel

Asset returns the underlying asset

func (*Channel) Context added in v0.279.0

func (c *Channel) Context(env envs.Environment) map[string]types.XValue

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) String added in v0.279.0

func (c *Channel) String() string

func (*Channel) SupportsScheme added in v0.279.0

func (c *Channel) SupportsScheme(scheme string) bool

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

func ReadContact(sa Assets, data []byte, missing assets.MissingCallback) (*Contact, error)

ReadContact decodes a contact from the passed in JSON

func (*Contact) AddRoute added in v0.280.0

func (c *Contact) AddRoute(urn urns.URN, channel *Channel) bool

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

func (c *Contact) Clone() *Contact

Clone clones this contact when we need to snapshot as part of parent run summary.

func (*Contact) Context added in v0.280.0

func (c *Contact) Context(env envs.Environment) map[string]types.XValue

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

func (c *Contact) Country() i18n.Country

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) CreatedOn added in v0.280.0

func (c *Contact) CreatedOn() time.Time

CreatedOn returns the created on time of this contact

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) Groups added in v0.280.0

func (c *Contact) Groups() *GroupList

Groups returns the groups that this contact belongs to

func (*Contact) HasURN added in v0.280.0

func (c *Contact) HasURN(urn urns.URN) bool

func (*Contact) ID added in v0.280.0

func (c *Contact) ID() ContactID

ID returns the numeric ID of this contact

func (*Contact) Language added in v0.280.0

func (c *Contact) Language() i18n.Language

Language gets the language for this contact

func (*Contact) LastSeenOn added in v0.280.0

func (c *Contact) LastSeenOn() *time.Time

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

func (c *Contact) MarshalJSON() ([]byte, error)

MarshalJSON marshals this contact into JSON

func (*Contact) Name added in v0.280.0

func (c *Contact) Name() string

Name returns the name of this contact

func (*Contact) PreferredChannel added in v0.280.0

func (c *Contact) PreferredChannel() *Channel

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

func (c *Contact) PreferredURN() *URN

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) RemoveURN added in v0.280.0

func (c *Contact) RemoveURN(urn urns.URN) bool

RemoveURN removes an existing URN from this contact

func (*Contact) ResolveRoute added in v0.282.0

func (c *Contact) ResolveRoute() *Route

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

func (c *Contact) SetAffinity(urn urns.URN, ch *Channel) bool

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

func (c *Contact) SetLanguage(lang i18n.Language)

SetLanguage sets the language for this contact

func (*Contact) SetLastSeenOn added in v0.280.0

func (c *Contact) SetLastSeenOn(t time.Time)

SetLastSeenOn sets the last seen on time of this contact

func (*Contact) SetName added in v0.280.0

func (c *Contact) SetName(name string)

SetName sets the name of this contact

func (*Contact) SetRoutes added in v0.280.0

func (c *Contact) SetRoutes(routes []Route) bool

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

func (c *Contact) SetTimezone(tz *time.Location)

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) Timezone added in v0.280.0

func (c *Contact) Timezone() *time.Location

Timezone returns the timezone of this contact

func (*Contact) URNs added in v0.280.0

func (c *Contact) URNs() URNList

URNs returns the URNs of 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

func (c *Contact) UpdatePreferredChannel(channel *Channel) bool

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 ContactID added in v0.280.0

type ContactID int64

ContactID is the ID of a contact

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

type ContactUUID uuids.UUID

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

func NewDial

func NewDial(status DialStatus, duration int) *Dial

NewDial creates a new dial

func (*Dial) Context

func (d *Dial) Context(env envs.Environment) map[string]types.XValue

Context for dial resumes additionally exposes the dial object

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

type Field struct {
	assets.Field
}

Field represents a contact field

func NewField added in v0.280.0

func NewField(asset assets.Field) *Field

NewField creates a new field from the given asset

func (*Field) Asset added in v0.280.0

func (f *Field) Asset() assets.Field

Asset returns the underlying asset

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

type Global struct {
	assets.Global
}

Global represents a constant value available in expressions.

func NewGlobal added in v0.280.0

func NewGlobal(asset assets.Global) *Global

NewGlobal returns a new global object from the given global asset

func (*Global) Asset added in v0.280.0

func (g *Global) Asset() assets.Global

Asset returns the underlying 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

type Group struct {
	assets.Group
	// contains filtered or unexported fields
}

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) Asset added in v0.280.0

func (g *Group) Asset() assets.Group

Asset returns the underlying asset

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

func (*Group) ToXValue added in v0.280.0

func (g *Group) ToXValue(env envs.Environment) types.XValue

ToXValue returns a representation of this object for use in expressions

uuid:text -> the UUID of the group
name:text -> the name of the group

@context group

func (*Group) UsesQuery added in v0.280.0

func (g *Group) UsesQuery() bool

UsesQuery returns whether this group is query based

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)

func (*GroupAssets) Get added in v0.280.0

func (s *GroupAssets) Get(uuid assets.GroupUUID) *Group

Get returns the group with the given UUID

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) Add added in v0.280.0

func (l *GroupList) Add(group *Group) bool

Add adds the given group to this group list

func (*GroupList) All added in v0.280.0

func (l *GroupList) All() []*Group

All returns all groups in this group list

func (*GroupList) Clear added in v0.280.0

func (l *GroupList) Clear()

Clear clears this group list

func (*GroupList) Clone added in v0.280.0

func (l *GroupList) Clone() *GroupList

Clone returns a clone of this group list

func (*GroupList) Count added in v0.280.0

func (l *GroupList) Count() int

Count returns the number of groups in this group list

func (*GroupList) FindByUUID added in v0.280.0

func (l *GroupList) FindByUUID(uuid assets.GroupUUID) *Group

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

func (*GroupList) Remove added in v0.280.0

func (l *GroupList) Remove(group *Group) bool

Remove removes the given group from this group list

func (*GroupList) ToXValue added in v0.280.0

func (l *GroupList) ToXValue(env envs.Environment) types.XValue

ToXValue returns a representation of this object for use in expressions

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 HTTPLogger

type HTTPLogger struct {
	Logs []*HTTPLog
}

HTTPLogger logs HTTP logs

func (*HTTPLogger) Log

func (l *HTTPLogger) Log(h *HTTPLog)

Log logs the given HTTP log

type InputUUID

type InputUUID uuids.UUID

InputUUID is the UUID of an input

type LLM added in v0.279.0

type LLM struct {
	assets.LLM
}

LLM represents a large language model.

func NewLLM added in v0.279.0

func NewLLM(asset assets.LLM) *LLM

NewLLM returns a new LLM object from the given LLM asset

func (*LLM) Asset added in v0.279.0

func (l *LLM) Asset() assets.LLM

Asset returns the underlying asset

func (*LLM) HasRole added in v0.279.0

func (l *LLM) HasRole(role assets.LLMRole) bool

HasRole returns whether this LLM has the given role

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

func NewLLMAssets(llms []assets.LLM) *LLMAssets

NewLLMAssets creates a new set of LLM assets

func (*LLMAssets) Get added in v0.279.0

func (s *LLMAssets) Get(uuid assets.LLMUUID) *LLM

Get returns the LLM with the given UUID

type LLMResponse

type LLMResponse struct {
	Output       string
	TokensInput  int64
	TokensOutput int64
}

LLMResponse is the response from an LLM service call

type Label added in v0.280.0

type Label struct {
	assets.Label
}

Label represents a message label

func NewLabel added in v0.280.0

func NewLabel(asset assets.Label) *Label

NewLabel creates a new label from the given asset

func (*Label) Asset added in v0.280.0

func (l *Label) Asset() assets.Label

Asset returns the underlying asset

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)

func (*LabelAssets) Get added in v0.280.0

func (s *LabelAssets) Get(uuid assets.LabelUUID) *Label

Get returns the label with the given UUID

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:

  1. Exact match
  2. Match with punctuation removed
  3. Split input into words and try to match each word
  4. 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

func (m *MsgIn) ExternalID() string

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) Locale

func (m *MsgOut) Locale() i18n.Locale

Locale returns the locale of this message (if any)

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

type NodeUUID uuids.UUID

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

type OptIn struct {
	assets.OptIn
}

OptIn adds some functionality to optin assets.

func NewOptIn added in v0.279.0

func NewOptIn(asset assets.OptIn) *OptIn

NewOptIn returns a new optin object from the given optin asset

func (*OptIn) Asset added in v0.279.0

func (o *OptIn) Asset() assets.OptIn

Asset returns the underlying asset

func (*OptIn) Context added in v0.279.0

func (o *OptIn) Context(env envs.Environment) map[string]types.XValue

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

func (*OptInAssets) Get added in v0.279.0

func (s *OptInAssets) Get(uuid assets.OptInUUID) *OptIn

Get finds the optin with the given UUID

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

type Resthook struct {
	assets.Resthook
}

Resthook represents a named event and a set of subscribers

func NewResthook added in v0.280.0

func NewResthook(asset assets.Resthook) *Resthook

NewResthook returns a new resthook object

func (*Resthook) Asset added in v0.280.0

func (r *Resthook) Asset() assets.Resthook

Asset returns the underlying asset

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

func (r *Result) Context(env envs.Environment) map[string]types.XValue

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 Route added in v0.280.0

type Route struct {
	URN     urns.URN
	Channel *Channel
}

Route is a URN paired with the channel that should handle it

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 RunUUID

type RunUUID uuids.UUID

RunUUID is the UUID of a flow run

func NewRunUUID

func NewRunUUID() RunUUID

NewRunUUID generates a new UUID for a run

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

type SessionUUID uuids.UUID

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

type Template struct {
	assets.Template
}

Template represents messaging templates used by channels types such as WhatsApp

func NewTemplate added in v0.280.0

func NewTemplate(t assets.Template) *Template

NewTemplate returns a new template objects based on the passed in asset

func (*Template) Asset added in v0.280.0

func (t *Template) Asset() assets.Template

Asset returns the underlying 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

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

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 TemplatingComponent struct {
	Name      string         `json:"name"`
	Type      string         `json:"type"`
	Variables map[string]int `json:"variables"`
}

type TemplatingVariable

type TemplatingVariable struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

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

func OpenTicket(topic *Topic, assignee *User) *Ticket

OpenTicket creates a new ticket. Used by ticketing services to open a new ticket.

func (*Ticket) Assignee added in v0.279.0

func (t *Ticket) Assignee() *User

func (*Ticket) Context added in v0.279.0

func (t *Ticket) Context(env envs.Environment) map[string]types.XValue

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 (t *Ticket) SetAssignee(user *User)

func (*Ticket) SetStatus added in v0.279.0

func (t *Ticket) SetStatus(status TicketStatus)

func (*Ticket) SetTopic added in v0.279.0

func (t *Ticket) SetTopic(topic *Topic)

func (*Ticket) Status added in v0.279.0

func (t *Ticket) Status() TicketStatus

func (*Ticket) Topic added in v0.279.0

func (t *Ticket) Topic() *Topic

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

type TicketUUID uuids.UUID

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

type Topic struct {
	assets.Topic
}

Topic represents a ticket topic

func NewTopic added in v0.279.0

func NewTopic(asset assets.Topic) *Topic

NewTopic creates a new topic from the given asset

func (*Topic) Asset added in v0.279.0

func (t *Topic) Asset() assets.Topic

Asset returns the underlying asset

func (*Topic) Context added in v0.279.0

func (t *Topic) Context(env envs.Environment) map[string]types.XValue

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)

func (*TopicAssets) Get added in v0.279.0

func (s *TopicAssets) Get(uuid assets.TopicUUID) *Topic

Get returns the topic with the given UUID

type URN added in v0.279.0

type URN struct {
	Scheme  string
	Path    string
	Display string
	Channel *Channel
}

URN adds additional functionality around urns.URN such as channel affinity.

func NewURN added in v0.279.0

func NewURN(scheme, path, display string, channel *Channel) *URN

NewURN creates a new contact URN with associated channel

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

func (*URN) Encode added in v0.279.0

func (u *URN) Encode() urns.URN

Encode gets the URN as an encoded string

func (*URN) Equal added in v0.279.0

func (u *URN) Equal(other *URN) bool

Equal determines if this URN is equal to another

func (*URN) Identity added in v0.279.0

func (u *URN) Identity() urns.URN

Identity gets the URN as an identity URN (just scheme and path)

func (*URN) ToXValue added in v0.279.0

func (u *URN) ToXValue(env envs.Environment) types.XValue

ToXValue returns a representation of this object for use in expressions

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) Clone added in v0.279.0

func (l URNList) Clone() URNList

Clone returns a clone of this URN list

func (URNList) Encode added in v0.279.0

func (l URNList) Encode() []urns.URN

Encode returns encoded URNs

func (URNList) Equal added in v0.279.0

func (l URNList) Equal(other URNList) bool

Equal returns whether this list of URNs is equal to another

func (URNList) MapContext added in v0.279.0

func (l URNList) MapContext(env envs.Environment) map[string]types.XValue

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

func (l URNList) WithScheme(schemes ...string) URNList

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

type User struct {
	assets.User
}

User adds some functionality to user assets.

func NewUser added in v0.279.0

func NewUser(asset assets.User) *User

NewUser returns a new user object from the given user asset

func (*User) Asset added in v0.279.0

func (u *User) Asset() assets.User

Asset returns the underlying asset

func (*User) Context added in v0.279.0

func (u *User) Context(env envs.Environment) map[string]types.XValue

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

func (u *User) Format() string

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)

func (*UserAssets) Get added in v0.279.0

func (s *UserAssets) Get(uuid assets.UserUUID) *User

Get returns the user with the given UUID

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

func (*Value) Equals

func (v *Value) Equals(o *Value) bool

Equals determines whether two values are equal

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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