Documentation ¶
Index ¶
- Constants
- Variables
- func GroupReferenceValidation(sl validator.StructLevel)
- func IsPossibleLocationPath(str string) bool
- func LabelReferenceValidation(sl validator.StructLevel)
- func ValidateURN(fl validator.FieldLevel) bool
- func ValidateURNScheme(fl validator.FieldLevel) bool
- type Action
- type ActionUUID
- type Attachment
- func (a Attachment) ContentType() string
- func (a Attachment) Describe() string
- func (a Attachment) Reduce(env utils.Environment) types.XPrimitive
- func (a Attachment) Resolve(env utils.Environment, key string) types.XValue
- func (a Attachment) ToXJSON(env utils.Environment) types.XText
- func (a Attachment) URL() string
- type AttachmentList
- type BaseMsg
- type Channel
- type ChannelReference
- type ChannelRole
- type ChannelSet
- type ChannelUUID
- type Contact
- func (c *Contact) AddURN(urn urns.URN) bool
- func (c *Contact) Clone() *Contact
- func (c *Contact) CreatedOn() time.Time
- func (c *Contact) Describe() string
- func (c *Contact) Fields() FieldValues
- func (c *Contact) Format(env utils.Environment) string
- func (c *Contact) Groups() *GroupList
- func (c *Contact) HasURN(urn urns.URN) bool
- func (c *Contact) ID() int
- func (c *Contact) Language() utils.Language
- func (c *Contact) MarshalJSON() ([]byte, error)
- func (c *Contact) Name() string
- func (c *Contact) PreferredChannel() Channel
- func (c *Contact) Reduce(env utils.Environment) types.XPrimitive
- func (c *Contact) ReevaluateDynamicGroups(session Session) error
- func (c *Contact) Reference() *ContactReference
- func (c *Contact) Resolve(env utils.Environment, key string) types.XValue
- func (c *Contact) ResolveQueryKey(env utils.Environment, key string) []interface{}
- func (c *Contact) SetCreatedOn(createdOn time.Time)
- func (c *Contact) SetFieldValue(env utils.Environment, fieldSet *FieldSet, key string, rawValue string) error
- func (c *Contact) SetID(id int)
- func (c *Contact) SetLanguage(lang utils.Language)
- func (c *Contact) SetName(name string)
- func (c *Contact) SetTimezone(tz *time.Location)
- func (c *Contact) Timezone() *time.Location
- func (c *Contact) ToXJSON(env utils.Environment) types.XText
- func (c *Contact) URNs() URNList
- func (c *Contact) UUID() ContactUUID
- func (c *Contact) UpdatePreferredChannel(channel Channel)
- type ContactReference
- type ContactURN
- func (u *ContactURN) Channel() Channel
- func (u *ContactURN) Describe() string
- func (u *ContactURN) Reduce(env utils.Environment) types.XPrimitive
- func (u *ContactURN) Resolve(env utils.Environment, key string) types.XValue
- func (u *ContactURN) SetChannel(channel Channel)
- func (u *ContactURN) ToXJSON(env utils.Environment) types.XText
- type ContactUUID
- type EngineConfig
- type Event
- type EventLog
- type EventOrigin
- type Exit
- type ExitUUID
- type Field
- type FieldReference
- type FieldSet
- type FieldValue
- func (v *FieldValue) Describe() string
- func (v *FieldValue) IsEmpty() bool
- func (v *FieldValue) Reduce(env utils.Environment) types.XPrimitive
- func (v *FieldValue) Resolve(env utils.Environment, key string) types.XValue
- func (v *FieldValue) ToXJSON(env utils.Environment) types.XText
- func (v *FieldValue) TypedValue() types.XValue
- type FieldValueType
- type FieldValues
- type Flow
- type FlowReference
- type FlowRun
- type FlowUUID
- type Group
- func (g *Group) CheckDynamicMembership(env utils.Environment, contact *Contact) (bool, error)
- func (g *Group) Describe() string
- func (g *Group) IsDynamic() bool
- func (g *Group) Name() string
- func (g *Group) ParsedQuery() (*contactql.ContactQuery, error)
- func (g *Group) Query() string
- func (g *Group) Reduce(env utils.Environment) types.XPrimitive
- func (g *Group) Reference() *GroupReference
- func (g *Group) Resolve(env utils.Environment, key string) types.XValue
- func (g *Group) ToXJSON(env utils.Environment) types.XText
- func (g *Group) UUID() GroupUUID
- type GroupList
- func (l *GroupList) Add(group *Group) bool
- func (l *GroupList) All() []*Group
- func (l *GroupList) Count() int
- func (l GroupList) Describe() string
- func (l *GroupList) FindByUUID(uuid GroupUUID) *Group
- func (l *GroupList) Index(index int) types.XValue
- func (l *GroupList) Length() int
- func (l GroupList) Reduce(env utils.Environment) types.XPrimitive
- func (l *GroupList) Remove(group *Group) bool
- func (l GroupList) ToXJSON(env utils.Environment) types.XText
- type GroupReference
- type GroupSet
- type GroupUUID
- type Input
- type InputUUID
- type Label
- type LabelReference
- type LabelSet
- type LabelUUID
- type Localization
- type LocationHierarchySet
- type LocationPath
- type MsgIn
- type MsgOut
- type MsgUUID
- type Node
- type NodeUUID
- type Resthook
- type ResthookSet
- type Result
- type Results
- func (r Results) Clone() Results
- func (r Results) Describe() string
- func (r Results) Get(key string) *Result
- func (r Results) Length() int
- func (r Results) Reduce(env utils.Environment) types.XPrimitive
- func (r Results) Resolve(env utils.Environment, key string) types.XValue
- func (r Results) Save(name string, value string, category string, categoryLocalized string, ...)
- func (r Results) ToXJSON(env utils.Environment) types.XText
- type Route
- type Router
- type RunEnvironment
- type RunStatus
- type RunSummary
- type RunUUID
- type Session
- type SessionAssets
- type SessionStatus
- type Step
- type StepUUID
- type Translations
- type Trigger
- type URNList
- func (l URNList) Describe() string
- func (l URNList) Index(index int) types.XValue
- func (l URNList) Length() int
- func (l URNList) RawURNs(includeChannels bool) []urns.URN
- func (l URNList) Reduce(env utils.Environment) types.XPrimitive
- func (l URNList) Resolve(env utils.Environment, key string) types.XValue
- func (l URNList) ToXJSON(env utils.Environment) types.XText
- func (l URNList) WithScheme(scheme string) URNList
- type Wait
- type WebhookCall
- func (w *WebhookCall) Body() string
- func (w *WebhookCall) Describe() string
- func (w *WebhookCall) JSON() types.XValue
- func (r *WebhookCall) MarshalJSON() ([]byte, error)
- func (w *WebhookCall) Method() string
- func (w *WebhookCall) Reduce(env utils.Environment) types.XPrimitive
- func (w *WebhookCall) Request() string
- func (w *WebhookCall) Resolve(env utils.Environment, key string) types.XValue
- func (w *WebhookCall) Response() string
- func (w *WebhookCall) Status() WebhookStatus
- func (w *WebhookCall) StatusCode() int
- func (w *WebhookCall) ToXJSON(env utils.Environment) types.XText
- func (w *WebhookCall) URL() string
- func (w *WebhookCall) UnmarshalJSON(data []byte) error
- type WebhookMock
- type WebhookStatus
Constants ¶
const ( LocationLevelState = utils.LocationLevel(1) LocationLevelDistrict = utils.LocationLevel(2) LocationLevelWard = utils.LocationLevel(3) )
location levels which can be field types
Variables ¶
var DefaultWebhookPayload = `` /* 459-byte string literal not displayed */
var EmptyFieldValue = &FieldValue{}
EmptyFieldValue is used when a contact doesn't have a value set for a field
var NoRoute = Route{}
var REDACTED_URN = types.NewXText("********")
Functions ¶
func GroupReferenceValidation ¶ added in v0.4.0
func GroupReferenceValidation(sl validator.StructLevel)
GroupReferenceValidation validates that the given group reference is either a concrete reference or a name matcher
func IsPossibleLocationPath ¶ added in v0.9.6
IsPossibleLocationPath returns whether the given string could be a location path
func LabelReferenceValidation ¶ added in v0.4.0
func LabelReferenceValidation(sl validator.StructLevel)
LabelReferenceValidation validates that the given label reference is either a concrete reference or a name matcher
func ValidateURN ¶ added in v0.4.0
func ValidateURN(fl validator.FieldLevel) bool
ValidateURN validates whether the field value is a valid URN
func ValidateURNScheme ¶ added in v0.4.0
func ValidateURNScheme(fl validator.FieldLevel) bool
ValidateURNScheme validates whether the field value is a valid URN scheme
Types ¶
type Action ¶
type Action interface { UUID() ActionUUID Execute(FlowRun, Step, EventLog) error Validate(SessionAssets) error utils.Typed }
Action is an action within a flow node
type ActionUUID ¶
ActionUUID is the UUID of an action
func (ActionUUID) String ¶
func (u ActionUUID) String() string
type Attachment ¶ added in v0.4.0
type Attachment string
Attachment is a media attachment on a message, and it has the following properties which can be accessed:
- `content_type` the MIME type of the attachment
- `url` the URL of the attachment
Examples:
@run.input.attachments.0.content_type -> image/jpeg @run.input.attachments.0.url -> http://s3.amazon.com/bucket/test.jpg @(json(run.input.attachments.0)) -> {"content_type":"image/jpeg","url":"http://s3.amazon.com/bucket/test.jpg"}
@context attachment
func (Attachment) ContentType ¶ added in v0.4.0
func (a Attachment) ContentType() string
ContentType returns the MIME type of this attachment
func (Attachment) Describe ¶ added in v0.10.1
func (a Attachment) Describe() string
Describe returns a representation of this type for error messages
func (Attachment) Reduce ¶ added in v0.8.0
func (a Attachment) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (Attachment) Resolve ¶ added in v0.4.0
func (a Attachment) Resolve(env utils.Environment, key string) types.XValue
Resolve resolves the given key when this attachment is referenced in an expression
func (Attachment) ToXJSON ¶ added in v0.8.0
func (a Attachment) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
func (Attachment) URL ¶ added in v0.4.0
func (a Attachment) URL() string
URL returns the full URL of this attachment
type AttachmentList ¶ added in v0.8.0
type AttachmentList []Attachment
AttachmentList is a list of attachments
func (AttachmentList) Describe ¶ added in v0.10.1
func (a AttachmentList) Describe() string
Describe returns a representation of this type for error messages
func (AttachmentList) Index ¶ added in v0.8.0
func (a AttachmentList) Index(index int) types.XValue
Index is called when this object is indexed into in an expression
func (AttachmentList) Length ¶ added in v0.8.0
func (a AttachmentList) Length() int
Length is called when the length of this object is requested in an expression
func (AttachmentList) Reduce ¶ added in v0.8.0
func (a AttachmentList) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (AttachmentList) ToXJSON ¶ added in v0.8.0
func (a AttachmentList) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
type BaseMsg ¶ added in v0.6.0
type BaseMsg struct { UUID_ MsgUUID `json:"uuid"` URN_ urns.URN `json:"urn" validate:"omitempty,urn"` Channel_ *ChannelReference `json:"channel,omitempty"` Text_ string `json:"text"` Attachments_ []Attachment `json:"attachments,omitempty"` }
BaseMsg represents a incoming or outgoing message with the session contact
func (*BaseMsg) Attachments ¶ added in v0.6.0
func (m *BaseMsg) Attachments() []Attachment
Attachments returns the attachments of this message
func (*BaseMsg) Channel ¶ added in v0.6.0
func (m *BaseMsg) Channel() *ChannelReference
Channel returns the channel of this message
type Channel ¶
type Channel interface { types.XValue types.XResolvable UUID() ChannelUUID Name() string Address() string Schemes() []string SupportsScheme(string) bool Roles() []ChannelRole HasRole(ChannelRole) bool Reference() *ChannelReference }
Channel represents a means for sending and receiving input during a flow run. It renders as its name in a template, and has the following properties which can be accessed:
- `uuid` the UUID of the channel
- `name` the name of the channel
- `address` the address of the channel
Examples:
@contact.channel -> My Android Phone @contact.channel.name -> My Android Phone @contact.channel.address -> +12345671111 @run.input.channel.uuid -> 57f1078f-88aa-46f4-a59a-948a5739c03d @(json(contact.channel)) -> {"address":"+12345671111","name":"My Android Phone","uuid":"57f1078f-88aa-46f4-a59a-948a5739c03d"}
@context channel
func NewChannel ¶ added in v0.6.0
func NewChannel(uuid ChannelUUID, name string, address string, schemes []string, roles []ChannelRole) Channel
NewChannel creates a new channel
func ReadChannel ¶
func ReadChannel(data json.RawMessage) (Channel, error)
ReadChannel decodes a channel from the passed in JSON
type ChannelReference ¶ added in v0.4.0
type ChannelReference struct { UUID ChannelUUID `json:"uuid" validate:"required,uuid"` Name string `json:"name"` }
ChannelReference is used to reference a channel
func NewChannelReference ¶ added in v0.4.0
func NewChannelReference(uuid ChannelUUID, name string) *ChannelReference
NewChannelReference creates a new channel reference with the given UUID and name
type ChannelRole ¶ added in v0.6.0
type ChannelRole string
ChannelRole is a role that a channel can perform
const ( ChannelRoleSend ChannelRole = "send" ChannelRoleReceive ChannelRole = "receive" ChannelRoleCall ChannelRole = "call" ChannelRoleAnswer ChannelRole = "answer" ChannelRoleUSSD ChannelRole = "ussd" )
different roles that channels can perform
type ChannelSet ¶ added in v0.6.0
type ChannelSet struct {
// contains filtered or unexported fields
}
ChannelSet defines the unordered set of all channels for a session
func NewChannelSet ¶ added in v0.6.0
func NewChannelSet(channels []Channel) *ChannelSet
NewChannelSet creates a new channel set
func ReadChannelSet ¶ added in v0.6.0
func ReadChannelSet(data json.RawMessage) (*ChannelSet, error)
ReadChannelSet decodes channels from the passed in JSON
func (*ChannelSet) FindByUUID ¶ added in v0.6.0
func (s *ChannelSet) FindByUUID(uuid ChannelUUID) Channel
FindByUUID finds the channel with the given UUID
func (*ChannelSet) GetForURN ¶ added in v0.6.0
func (s *ChannelSet) GetForURN(urn *ContactURN) Channel
GetForURN returns the best channel for the given URN
type ChannelUUID ¶
ChannelUUID is the UUID of a channel
func (ChannelUUID) String ¶
func (u ChannelUUID) String() string
type Contact ¶
type Contact struct {
// contains filtered or unexported fields
}
Contact represents a person who is interacting with the flow. It renders as the person's name (or perferred URN if name isn't set) in a template, and has the following properties which can be accessed:
- `uuid` the UUID of the contact
- `name` the full name of the contact
- `first_name` the first name of the contact
- `language` the [ISO-639-3](http://www-01.sil.org/iso639-3/) language code of the contact
- `timezone` the timezone name of the contact
- `created_on` the datetime when the contact was created
- `urns` all [URNs](#context:urn) the contact has set
- `urns.[scheme]` all the [URNs](#context:urn) the contact has set for the particular URN scheme
- `urn` shorthand for `@(format_urn(c.urns.0))`, i.e. the contact's preferred [URN](#context:urn) in friendly formatting
- `groups` all the [groups](#context:group) that the contact belongs to
- `fields` all the custom contact fields the contact has set
- `fields.[snaked_field_name]` the value of the specific field
- `channel` shorthand for `contact.urns.0.channel`, i.e. the [channel](#context:channel) of the contact's preferred URN
Examples:
@contact -> Ryan Lewis @contact.name -> Ryan Lewis @contact.first_name -> Ryan @contact.language -> eng @contact.timezone -> America/Guayaquil @contact.created_on -> 2018-06-20T11:40:30.123456Z @contact.urns -> ["tel:+12065551212","twitterid:54784326227#nyaruka","mailto:foo@bar.com"] @contact.urns.0 -> tel:+12065551212 @contact.urns.tel -> ["tel:+12065551212"] @contact.urns.mailto.0 -> mailto:foo@bar.com @contact.urn -> (206) 555-1212 @contact.groups -> ["Testers","Males"] @contact.fields -> {"activation_token":"AACC55","age":"23","gender":"Male","join_date":"2017-12-02T00:00:00.000000-02:00"} @contact.fields.activation_token -> AACC55 @contact.fields.gender -> Male
@context contact
func NewContact ¶ added in v0.5.1
NewContact returns a new contact
func ReadContact ¶
func ReadContact(session Session, data json.RawMessage) (*Contact, error)
ReadContact decodes a contact from the passed in JSON
func (*Contact) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (*Contact) Fields ¶
func (c *Contact) Fields() FieldValues
Fields returns this contact's field values
func (*Contact) Format ¶ added in v0.10.18
func (c *Contact) Format(env utils.Environment) string
Format returns a friendly string version of this contact depending on what fields are set
func (*Contact) MarshalJSON ¶
MarshalJSON marshals this contact into JSON
func (*Contact) PreferredChannel ¶ added in v0.11.0
PreferredChannel gets the preferred channel for this contact, i.e. the preferred channel of their highest priority URN
func (*Contact) Reduce ¶ added in v0.8.0
func (c *Contact) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (*Contact) ReevaluateDynamicGroups ¶ added in v0.9.6
ReevaluateDynamicGroups reevaluates membership of all dynamic groups for this contact
func (*Contact) Reference ¶ added in v0.4.0
func (c *Contact) Reference() *ContactReference
Reference returns a reference to this contact
func (*Contact) Resolve ¶
Resolve resolves the given key when this contact is referenced in an expression
func (*Contact) ResolveQueryKey ¶ added in v0.4.0
func (c *Contact) ResolveQueryKey(env utils.Environment, key string) []interface{}
ResolveQueryKey resolves a contact query search key for this contact
func (*Contact) SetCreatedOn ¶ added in v0.10.15
SetCreatedOn sets the created on time of this contact
func (*Contact) SetFieldValue ¶ added in v0.8.0
func (c *Contact) SetFieldValue(env utils.Environment, fieldSet *FieldSet, key string, rawValue string) error
SetFieldValue updates the given contact field value for this contact
func (*Contact) SetLanguage ¶
SetLanguage sets the language for this contact
func (*Contact) SetTimezone ¶
SetTimezone sets the timezone of this contact
func (*Contact) ToXJSON ¶ added in v0.8.0
func (c *Contact) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
func (*Contact) UpdatePreferredChannel ¶ added in v0.6.0
UpdatePreferredChannel updates the preferred channel
type ContactReference ¶
type ContactReference struct { UUID ContactUUID `json:"uuid" validate:"required,uuid4"` Name string `json:"name"` }
ContactReference is used to reference a contact
func NewContactReference ¶ added in v0.4.0
func NewContactReference(uuid ContactUUID, name string) *ContactReference
NewContactReference creates a new contact reference with the given UUID and name
type ContactURN ¶ added in v0.6.0
ContactURN represents a destination for an outgoing message or a source of an incoming message. It is string composed of 3 components: scheme, path, and display (optional). For example:
- _tel:+16303524567_
- _twitterid:54784326227#nyaruka_
- _telegram:34642632786#bobby_
It has several properties which can be accessed in expressions:
- `scheme` the scheme of the URN, e.g. "tel", "twitter"
- `path` the path of the URN, e.g. "+16303524567"
- `display` the display portion of the URN, e.g. "+16303524567"
- `channel` the preferred [channel](#context:channel) of the URN
To render a URN in a human friendly format, use the [format_urn](#function:format_urn) function.
Examples:
@contact.urns.0 -> tel:+12065551212 @contact.urns.0.scheme -> tel @contact.urns.0.path -> +12065551212 @contact.urns.1.display -> nyaruka @(format_urn(contact.urns.0)) -> (206) 555-1212 @(json(contact.urns.0)) -> {"display":"","path":"+12065551212","scheme":"tel"}
@context urn
func NewContactURN ¶ added in v0.6.0
func NewContactURN(urn urns.URN, channel Channel) *ContactURN
NewContactURN creates a new contact URN with associated channel
func (*ContactURN) Channel ¶ added in v0.6.0
func (u *ContactURN) Channel() Channel
Channel gets the channel associated with this URN
func (*ContactURN) Describe ¶ added in v0.10.1
func (u *ContactURN) Describe() string
Describe returns a representation of this type for error messages
func (*ContactURN) Reduce ¶ added in v0.8.0
func (u *ContactURN) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (*ContactURN) Resolve ¶ added in v0.6.0
func (u *ContactURN) Resolve(env utils.Environment, key string) types.XValue
Resolve resolves the given key when this URN is referenced in an expression
func (*ContactURN) SetChannel ¶ added in v0.6.0
func (u *ContactURN) SetChannel(channel Channel)
SetChannel sets the channel associated with this URN
func (*ContactURN) ToXJSON ¶ added in v0.8.0
func (u *ContactURN) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
type ContactUUID ¶
ContactUUID is the UUID of a contact
func (ContactUUID) String ¶
func (u ContactUUID) String() string
type EngineConfig ¶ added in v0.9.3
type EngineConfig interface { DisableWebhooks() bool WebhookMocks() []*WebhookMock MaxWebhookResponseBytes() int }
type Event ¶
type Event interface { CreatedOn() time.Time StepUUID() StepUUID SetStepUUID(StepUUID) FromCaller() bool SetFromCaller(bool) AllowedOrigin() EventOrigin Validate(SessionAssets) error Apply(FlowRun) error utils.Typed }
Event describes a state change
type EventOrigin ¶ added in v0.6.0
type EventOrigin int
EventOrigin is the allowed origin of an event
const ( // EventOriginCaller means an event can originate from the caller EventOriginCaller EventOrigin = 1 // EventOriginEngine means an event can originate from the engine EventOriginEngine EventOrigin = 2 )
type Field ¶
type Field struct {
// contains filtered or unexported fields
}
Field represents a contact field
func NewField ¶ added in v0.4.0
func NewField(key string, name string, valueType FieldValueType) *Field
NewField returns a new field object with the passed in uuid, key and value type
type FieldReference ¶ added in v0.4.0
type FieldReference struct { Key string `json:"key" validate:"required"` Name string `json:"name"` }
FieldReference is a reference to field
func NewFieldReference ¶ added in v0.4.0
func NewFieldReference(key string, label string) *FieldReference
NewFieldReference creates a new field reference with the given key and label
type FieldSet ¶ added in v0.4.0
type FieldSet struct {
// contains filtered or unexported fields
}
FieldSet defines the unordered set of all fields for a session
func NewFieldSet ¶ added in v0.4.0
NewFieldSet creates a new set of fields
func ReadFieldSet ¶ added in v0.4.0
func ReadFieldSet(data json.RawMessage) (*FieldSet, error)
ReadFieldSet reads a set of contact fields from the given JSON
func (*FieldSet) FirstOfType ¶ added in v0.9.6
func (s *FieldSet) FirstOfType(valueType FieldValueType) *Field
FirstOfType returns the first field in this set with the given value type
type FieldValue ¶ added in v0.4.0
type FieldValue struct {
// contains filtered or unexported fields
}
FieldValue represents a contact's value for a specific field
func NewEmptyFieldValue ¶ added in v0.9.6
func NewEmptyFieldValue(field *Field) *FieldValue
NewEmptyFieldValue creates a new empty value for the given field
func (*FieldValue) Describe ¶ added in v0.10.1
func (v *FieldValue) Describe() string
Describe returns a representation of this type for error messages
func (*FieldValue) IsEmpty ¶ added in v0.8.0
func (v *FieldValue) IsEmpty() bool
IsEmpty returns whether this field value is set for any type
func (*FieldValue) Reduce ¶ added in v0.8.0
func (v *FieldValue) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (*FieldValue) Resolve ¶ added in v0.4.0
func (v *FieldValue) Resolve(env utils.Environment, key string) types.XValue
Resolve resolves the given key when this field value is referenced in an expression
func (*FieldValue) ToXJSON ¶ added in v0.8.0
func (v *FieldValue) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
func (*FieldValue) TypedValue ¶ added in v0.8.0
func (v *FieldValue) TypedValue() types.XValue
TypedValue returns the value in its proper type
type FieldValueType ¶ added in v0.4.0
type FieldValueType string
FieldValueType is the data type of values for each field
const ( FieldValueTypeText FieldValueType = "text" FieldValueTypeNumber FieldValueType = "number" FieldValueTypeDatetime FieldValueType = "datetime" FieldValueTypeWard FieldValueType = "ward" FieldValueTypeDistrict FieldValueType = "district" FieldValueTypeState FieldValueType = "state" )
field value types
type FieldValues ¶ added in v0.4.0
type FieldValues map[string]*FieldValue
FieldValues is the set of all field values for a contact
func (FieldValues) Describe ¶ added in v0.10.1
func (f FieldValues) Describe() string
Describe returns a representation of this type for error messages
func (FieldValues) Length ¶ added in v0.8.0
func (f FieldValues) Length() int
Length is called to get the length of this object
func (FieldValues) Reduce ¶ added in v0.8.0
func (f FieldValues) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (FieldValues) Resolve ¶ added in v0.4.0
func (f FieldValues) Resolve(env utils.Environment, key string) types.XValue
Resolve resolves the given key when this set of field values is referenced in an expression
func (FieldValues) ToXJSON ¶ added in v0.8.0
func (f FieldValues) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
type Flow ¶
type Flow interface { types.XValue types.XResolvable UUID() FlowUUID Name() string Revision() int Language() utils.Language ExpireAfterMinutes() int Localization() Localization Validate(SessionAssets) error Nodes() []Node GetNode(uuid NodeUUID) Node Reference() *FlowReference }
Flow describes the ordered logic of actions and routers. It renders as its name in a template, and has the following properties which can be accessed:
- `uuid` the UUID of the flow
- `name` the name of the flow
- `revision` the revision number of the flow
Examples:
@run.flow -> Registration @child.flow -> Collect Age @run.flow.uuid -> 50c3706e-fedb-42c0-8eab-dda3335714b7 @(json(run.flow)) -> {"name":"Registration","revision":123,"uuid":"50c3706e-fedb-42c0-8eab-dda3335714b7"}
@context flow
type FlowReference ¶ added in v0.4.0
type FlowReference struct { UUID FlowUUID `json:"uuid" validate:"uuid4"` Name string `json:"name"` }
FlowReference is used to reference a flow from another flow
func NewFlowReference ¶ added in v0.4.0
func NewFlowReference(uuid FlowUUID, name string) *FlowReference
NewFlowReference creates a new flow reference with the given UUID and name
type FlowRun ¶
type FlowRun interface { types.XValue types.XResolvable RunSummary Environment() RunEnvironment Session() Session Context() types.XValue Input() Input Webhook() *WebhookCall SetContact(*Contact) SetInput(Input) SetStatus(RunStatus) SetWebhook(*WebhookCall) ApplyEvent(Step, Action, Event) error AddError(Step, Action, error) AddFatalError(Step, Action, error) CreateStep(Node) Step Path() []Step PathLocation() (Step, Node, error) Events() []Event EvaluateTemplate(template string) (types.XValue, error) EvaluateTemplateAsString(template string, urlEncode bool) (string, error) GetText(utils.UUID, string, string) string GetTextArray(utils.UUID, string, []string) []string GetTranslatedTextArray(utils.UUID, string, []string, utils.LanguageList) []string Snapshot() RunSummary Parent() RunSummary ParentInSession() FlowRun Ancestors() []FlowRun CreatedOn() time.Time ExpiresOn() *time.Time ResetExpiration(*time.Time) ExitedOn() *time.Time Exit(RunStatus) }
FlowRun is a single contact's journey through a flow. It records the path they have taken, and the results that have been collected. It has several properties which can be accessed in expressions:
- `uuid` the UUID of the run
- `flow` the [flow](#context:flow) of the run
- `contact` the [contact](#context:contact) of the flow run
- `input` the [input](#context:input) of the current run
- `results` the results that have been saved for this run
- `results.[snaked_result_name]` the value of the specific result, e.g. `run.results.age`
- `webhook` the last [webhook](#context:webhook) call made in the current run
Examples:
@run.flow.name -> Registration
@context run
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group represents a grouping of contacts. It can be static (contacts are added and removed manually through [actions](#action:add_contact_groups)) or dynamic (contacts are added automatically by a query). It renders as its name in a template, and has the following properties which can be accessed:
- `uuid` the UUID of the group
- `name` the name of the group
Examples:
@contact.groups -> ["Testers","Males"] @contact.groups.0.uuid -> b7cf0d83-f1c9-411c-96fd-c511a4cfa86d @contact.groups.1.name -> Males @(json(contact.groups.1)) -> {"name":"Males","uuid":"4f1f98fc-27a7-4a69-bbdb-24744ba739a9"}
@context group
func ReadGroup ¶ added in v0.4.0
func ReadGroup(data json.RawMessage) (*Group, error)
ReadGroup reads a group from the given JSON
func (*Group) CheckDynamicMembership ¶ added in v0.4.0
CheckDynamicMembership returns whether the given contact belongs in this dynamic group
func (*Group) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (*Group) ParsedQuery ¶ added in v0.4.0
func (g *Group) ParsedQuery() (*contactql.ContactQuery, error)
ParsedQuery returns the parsed query of a dynamic group (cached)
func (*Group) Reduce ¶ added in v0.8.0
func (g *Group) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (*Group) Reference ¶ added in v0.4.0
func (g *Group) Reference() *GroupReference
Reference returns a reference to this group
func (*Group) Resolve ¶
Resolve resolves the given key when this group is referenced in an expression
type GroupList ¶
type GroupList struct {
// contains filtered or unexported fields
}
GroupList defines a contact's list of groups
func NewGroupList ¶ added in v0.4.0
NewGroupList creates a new group list
func (GroupList) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (*GroupList) FindByUUID ¶ added in v0.4.0
FindByUUID returns the group with the passed in UUID or nil if not found
func (*GroupList) Index ¶ added in v0.8.0
Index is called when this object is indexed into in an expression
func (*GroupList) Length ¶ added in v0.8.0
Length is called when the length of this object is requested in an expression
func (GroupList) Reduce ¶ added in v0.8.0
func (l GroupList) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
type GroupReference ¶ added in v0.4.0
type GroupReference struct { UUID GroupUUID `json:"uuid,omitempty" validate:"omitempty,uuid4"` Name string `json:"name,omitempty"` NameMatch string `json:"name_match,omitempty"` }
GroupReference is used to reference a group
func NewGroupReference ¶ added in v0.4.0
func NewGroupReference(uuid GroupUUID, name string) *GroupReference
NewGroupReference creates a new group reference with the given UUID and name
func NewVariableGroupReference ¶ added in v0.4.0
func NewVariableGroupReference(nameMatch string) *GroupReference
NewVariableGroupReference creates a new group reference from the given templatized name match
type GroupSet ¶ added in v0.4.0
type GroupSet struct {
// contains filtered or unexported fields
}
GroupSet defines the unordered set of all groups for a session
func NewGroupSet ¶ added in v0.4.0
NewGroupSet creates a new group set from the given list of groups
func ReadGroupSet ¶ added in v0.4.0
func ReadGroupSet(data json.RawMessage) (*GroupSet, error)
ReadGroupSet reads a group set from the given JSON
func (*GroupSet) Dynamic ¶ added in v0.10.10
Dynamic returns all the dynamic groups in this group set
func (*GroupSet) FindByName ¶ added in v0.4.0
FindByName looks for a group with the given name (case-insensitive)
func (*GroupSet) FindByUUID ¶ added in v0.4.0
FindByUUID finds the group with the given UUID
type Input ¶
type Input interface { types.XValue utils.Typed UUID() InputUUID CreatedOn() time.Time Channel() Channel }
Input describes input from the contact and currently we only support one type of input: `msg`. Any input has the following properties which can be accessed:
- `uuid` the UUID of the input
- `type` the type of the input, e.g. `msg`
- `channel` the [channel](#context:channel) that the input was received on
- `created_on` the time when the input was created
An input of type `msg` renders as its text and attachments in a template, and has the following additional properties:
- `text` the text of the message
- `attachments` any [attachments](#context:attachment) on the message
- `urn` the [URN](#context:urn) that the input was received on
Examples:
@run.input -> Hi there\nhttp://s3.amazon.com/bucket/test.jpg\nhttp://s3.amazon.com/bucket/test.mp3 @run.input.type -> msg @run.input.text -> Hi there @run.input.attachments -> ["http://s3.amazon.com/bucket/test.jpg","http://s3.amazon.com/bucket/test.mp3"] @(json(run.input)) -> {"attachments":[{"content_type":"image/jpeg","url":"http://s3.amazon.com/bucket/test.jpg"},{"content_type":"audio/mp3","url":"http://s3.amazon.com/bucket/test.mp3"}],"channel":{"address":"+12345671111","name":"My Android Phone","uuid":"57f1078f-88aa-46f4-a59a-948a5739c03d"},"created_on":"2000-01-01T00:00:00.000000Z","text":"Hi there","type":"msg","urn":{"display":"","path":"+12065551212","scheme":"tel"},"uuid":"9bf91c2b-ce58-4cef-aacc-281e03f69ab5"}
@context input
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
Label represents a message label
func ReadLabel ¶ added in v0.4.0
func ReadLabel(data json.RawMessage) (*Label, error)
ReadLabel reads a label from the given JSON
func (*Label) Reference ¶ added in v0.4.0
func (l *Label) Reference() *LabelReference
Reference returns a reference to this label
type LabelReference ¶ added in v0.4.0
type LabelReference struct { UUID LabelUUID `json:"uuid,omitempty" validate:"omitempty,uuid4"` Name string `json:"name,omitempty"` NameMatch string `json:"name_match,omitempty"` }
LabelReference is used to reference a label
func NewLabelReference ¶ added in v0.4.0
func NewLabelReference(uuid LabelUUID, name string) *LabelReference
NewLabelReference creates a new label reference with the given UUID and name
func NewVariableLabelReference ¶ added in v0.4.0
func NewVariableLabelReference(nameMatch string) *LabelReference
NewVariableLabelReference creates a new label reference from the given templatized name match
type LabelSet ¶ added in v0.4.0
type LabelSet struct {
// contains filtered or unexported fields
}
LabelSet defines the unordered set of all labels for a session
func NewLabelSet ¶ added in v0.4.0
NewLabelSet creates a new label set from the given slice of labels
func ReadLabelSet ¶ added in v0.4.0
func ReadLabelSet(data json.RawMessage) (*LabelSet, error)
ReadLabelSet reads a label set from the given JSON
func (*LabelSet) FindByName ¶ added in v0.4.0
FindByName looks for a label with the given name (case-insensitive)
func (*LabelSet) FindByUUID ¶ added in v0.4.0
FindByUUID finds the label with the given UUID
type Localization ¶ added in v0.6.2
type Localization interface { AddItemTranslation(utils.Language, utils.UUID, string, []string) GetTranslations(utils.Language) Translations Languages() utils.LanguageList }
Localization provide a way to get the translations for a specific language
type LocationHierarchySet ¶ added in v0.11.0
type LocationHierarchySet struct {
// contains filtered or unexported fields
}
LocationHierarchySet defines the unordered set of all location hierarchies for a session
func NewLocationHierarchySet ¶ added in v0.11.0
func NewLocationHierarchySet(hierarchies []*utils.LocationHierarchy) *LocationHierarchySet
NewLocationHierarchySet creates a new location hierarchy set from the given list of hierarchies
func ReadLocationHierarchySet ¶ added in v0.11.0
func ReadLocationHierarchySet(data json.RawMessage) (*LocationHierarchySet, error)
ReadLocationHierarchySet reads a location hierarchy set from the given JSON
func (*LocationHierarchySet) All ¶ added in v0.11.0
func (s *LocationHierarchySet) All() []*utils.LocationHierarchy
All returns all hierarchies in this location hierarchy set
type LocationPath ¶ added in v0.9.6
type LocationPath string
LocationPath is a location described by a path Country > State ...
func (LocationPath) Describe ¶ added in v0.10.1
func (p LocationPath) Describe() string
Describe returns a representation of this type for error messages
func (LocationPath) Name ¶ added in v0.9.6
func (p LocationPath) Name() string
Name returns the name of the location referenced
func (LocationPath) Reduce ¶ added in v0.9.6
func (p LocationPath) Reduce(env utils.Environment) types.XPrimitive
Reduce returns the primitive version of this type
func (LocationPath) String ¶ added in v0.9.6
func (p LocationPath) String() string
func (LocationPath) ToXJSON ¶ added in v0.9.6
func (p LocationPath) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
type MsgIn ¶
type MsgIn struct {
BaseMsg
}
MsgIn represents a incoming message from the session contact
type MsgOut ¶
MsgOut represents a outgoing message to the session contact
func NewMsgOut ¶ added in v0.6.0
func NewMsgOut(urn urns.URN, channel Channel, text string, attachments []Attachment, quickReplies []string) *MsgOut
NewMsgOut creates a new outgoing message
func (*MsgOut) QuickReplies ¶ added in v0.6.0
QuickReplies returns the quick replies of this outgoing message
type Node ¶
type Node interface { UUID() NodeUUID Actions() []Action AddAction(Action) Router() Router Exits() []Exit Wait() Wait }
Node is a single node in a flow
type Resthook ¶ added in v0.10.20
type Resthook struct {
// contains filtered or unexported fields
}
Resthook represents a named event and a set of subscribers
func NewResthook ¶ added in v0.10.20
NewResthook returns a new resthook object
func ReadResthook ¶ added in v0.10.20
func ReadResthook(data json.RawMessage) (*Resthook, error)
ReadResthook reads a resthook from the given JSON
func (*Resthook) Subscribers ¶ added in v0.10.20
Subscribers returns the subscribers to the resthook
type ResthookSet ¶ added in v0.10.20
type ResthookSet struct {
// contains filtered or unexported fields
}
ResthookSet defines the unordered set of all resthooks for a session
func NewResthookSet ¶ added in v0.10.20
func NewResthookSet(resthooks []*Resthook) *ResthookSet
NewResthookSet creates a new resthook set from the given list of resthooks
func ReadResthookSet ¶ added in v0.10.20
func ReadResthookSet(data json.RawMessage) (*ResthookSet, error)
ReadResthookSet reads a resthook set from the given JSON
func (*ResthookSet) FindBySlug ¶ added in v0.10.20
func (s *ResthookSet) FindBySlug(slug string) *Resthook
FindBySlug finds the group with the given UUID
type Result ¶
type Result struct { Name string `json:"name"` 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"` CreatedOn time.Time `json:"created_on"` }
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.It renders as its value in a template, and has the following properties which can be accessed:
- `value` the value of the result
- `category` the category of the result
- `category_localized` the localized category of the result
- `input` the input associated with the result
- `node_uuid` the UUID of the node where the result was created
- `created_on` the time when the result was created
Examples:
@run.results.favorite_color -> red @run.results.favorite_color.value -> red @run.results.favorite_color.category -> Red
@context result
func (*Result) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (*Result) Reduce ¶ added in v0.8.0
func (r *Result) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
type Results ¶
Results is our wrapper around a map of snakified result names to result objects
func (Results) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (Results) Reduce ¶ added in v0.8.0
func (r Results) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
type RunEnvironment ¶ added in v0.8.0
type RunEnvironment interface { utils.Environment FindLocations(string, utils.LocationLevel, *utils.Location) ([]*utils.Location, error) FindLocationsFuzzy(string, utils.LocationLevel, *utils.Location) ([]*utils.Location, error) LookupLocation(LocationPath) (*utils.Location, error) }
RunEnvironment is a run specific environment which adds location functionality required by some router tests
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" // RunStatusErrored represents a run that encountered an error RunStatusErrored RunStatus = "errored" // RunStatusExpired represents a run that expired due to inactivity RunStatusExpired RunStatus = "expired" // RunStatusInterrupted represents a run that was interrupted by another flow RunStatusInterrupted RunStatus = "interrupted" )
type RunSummary ¶ added in v0.4.0
type RunSummary interface { UUID() RunUUID Contact() *Contact Flow() Flow Status() RunStatus Results() Results }
RunSummary represents the minimum information available about all runs (current or related) and is the representation of runs made accessible to router tests.
type Session ¶
type Session interface { Assets() SessionAssets Environment() utils.Environment SetEnvironment(utils.Environment) Contact() *Contact SetContact(*Contact) Status() SessionStatus Trigger() Trigger PushFlow(Flow, FlowRun) Wait() Wait FlowOnStack(FlowUUID) bool Start(Trigger, []Event) error Resume([]Event) error Runs() []FlowRun GetRun(RunUUID) (FlowRun, error) GetCurrentChild(FlowRun) FlowRun ParentRun() RunSummary Events() []Event LogEvent(Event) EngineConfig() EngineConfig HTTPClient() *utils.HTTPClient }
Session represents the session of a flow run which may contain many runs
type SessionAssets ¶ added in v0.4.0
type SessionAssets interface { GetChannel(ChannelUUID) (Channel, error) GetChannelSet() (*ChannelSet, error) GetField(string) (*Field, error) GetFieldSet() (*FieldSet, error) GetFlow(FlowUUID) (Flow, error) GetGroup(GroupUUID) (*Group, error) GetGroupSet() (*GroupSet, error) GetLabel(LabelUUID) (*Label, error) GetLabelSet() (*LabelSet, error) HasLocations() bool GetLocationHierarchySet() (*LocationHierarchySet, error) GetResthookSet() (*ResthookSet, error) }
SessionAssets is the assets available to a session
type SessionStatus ¶ added in v0.4.0
type SessionStatus string
SessionStatus represents the current status of the engine session
const ( // SessionStatusActive represents a session that is still active SessionStatusActive SessionStatus = "active" // SessionStatusCompleted represents a session that has run to completion SessionStatusCompleted SessionStatus = "completed" // SessionStatusWaiting represents a session which is waiting for something from the caller SessionStatusWaiting SessionStatus = "waiting" // SessionStatusErrored represents a session that encountered an error SessionStatusErrored SessionStatus = "errored" )
func (SessionStatus) String ¶ added in v0.4.0
func (r SessionStatus) String() string
type Translations ¶
Translations provide a way to get the translation for a specific language for a uuid/key pair
type Trigger ¶ added in v0.4.0
type Trigger interface { utils.Typed types.XValue types.XResolvable Environment() utils.Environment Flow() Flow Contact() *Contact Params() types.XValue TriggeredOn() time.Time }
Trigger represents something which can initiate a session with the flow engine. It has several properties which can be accessed in expressions:
- `type` the type of the trigger, one of "manual" or "flow"
- `params` the parameters passed to the trigger
Examples:
@trigger.type -> flow_action @trigger.params -> {"source": "website","address": {"state": "WA"}} @(json(trigger)) -> {"params":{"source":"website","address":{"state":"WA"}},"type":"flow_action"}
@context trigger
type URNList ¶
type URNList []*ContactURN
URNList is the list of a contact's URNs
func ReadURNList ¶ added in v0.6.0
ReadURNList parses contact URN list from the given list of raw URNs
func (URNList) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (URNList) Index ¶ added in v0.8.0
Index is called when this object is indexed into in an expression
func (URNList) Length ¶ added in v0.8.0
Length is called when the length of this object is requested in an expression
func (URNList) RawURNs ¶ added in v0.6.0
RawURNs returns the raw URNs with or without channel information
func (URNList) Reduce ¶ added in v0.8.0
func (l URNList) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (URNList) Resolve ¶
Resolve resolves the given key when this URN list is referenced in an expression
func (URNList) ToXJSON ¶ added in v0.8.0
func (l URNList) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
func (URNList) WithScheme ¶ added in v0.4.4
WithScheme returns a new URN list containing of only URNs of the given scheme
type WebhookCall ¶ added in v0.8.0
type WebhookCall struct {
// contains filtered or unexported fields
}
WebhookCall describes a call made to an external service. It has several properties which can be accessed in expressions:
- `status` the status of the webhook - one of "success", "connection_error" or "response_error"
- `status_code` the status code of the response
- `body` the body of the response
- `json` the parsed JSON response (if response body was JSON)
- `json.[key]` sub-elements of the parsed JSON response
- `request` the raw request made, including headers
- `response` the raw response received, including headers
Examples:
@run.webhook.status_code -> 200 @run.webhook.json.results.0.state -> WA
@context webhook
func MakeWebhookCall ¶ added in v0.8.0
func MakeWebhookCall(session Session, request *http.Request) (*WebhookCall, error)
MakeWebhookCall fires the passed in http request, returning any errors encountered. RequestResponse is always set regardless of any errors being set
func NewWebhookCall ¶ added in v0.10.20
func NewWebhookCall(url string, status WebhookStatus, statusCode int, request string, response string) *WebhookCall
NewWebhookCall creates a new webhook call
func (*WebhookCall) Body ¶ added in v0.8.0
func (w *WebhookCall) Body() string
Body returns the response body
func (*WebhookCall) Describe ¶ added in v0.10.1
func (w *WebhookCall) Describe() string
Describe returns a representation of this type for error messages
func (*WebhookCall) JSON ¶ added in v0.8.0
func (w *WebhookCall) JSON() types.XValue
JSON returns the response as a JSON fragment
func (*WebhookCall) MarshalJSON ¶ added in v0.8.0
func (r *WebhookCall) MarshalJSON() ([]byte, error)
MarshalJSON marshals this request response into JSON
func (*WebhookCall) Method ¶ added in v0.9.3
func (w *WebhookCall) Method() string
Method returns the full HTTP method
func (*WebhookCall) Reduce ¶ added in v0.8.0
func (w *WebhookCall) Reduce(env utils.Environment) types.XPrimitive
Reduce reduces this to a string of method and URL, e.g. "GET http://example.com/hook.php"
func (*WebhookCall) Request ¶ added in v0.8.0
func (w *WebhookCall) Request() string
Request returns the request trace
func (*WebhookCall) Resolve ¶ added in v0.8.0
func (w *WebhookCall) Resolve(env utils.Environment, key string) types.XValue
Resolve resolves the given key when this webhook is referenced in an expression
func (*WebhookCall) Response ¶ added in v0.8.0
func (w *WebhookCall) Response() string
Response returns the response trace
func (*WebhookCall) Status ¶ added in v0.8.0
func (w *WebhookCall) Status() WebhookStatus
Status returns the response status message
func (*WebhookCall) StatusCode ¶ added in v0.8.0
func (w *WebhookCall) StatusCode() int
StatusCode returns the response status code
func (*WebhookCall) ToXJSON ¶ added in v0.8.0
func (w *WebhookCall) ToXJSON(env utils.Environment) types.XText
ToXJSON is called when this type is passed to @(json(...))
func (*WebhookCall) URL ¶ added in v0.8.0
func (w *WebhookCall) URL() string
URL returns the full URL
func (*WebhookCall) UnmarshalJSON ¶ added in v0.8.0
func (w *WebhookCall) UnmarshalJSON(data []byte) error
UnmarshalJSON unmarshals a request response from the given JSON
type WebhookMock ¶ added in v0.10.12
type WebhookStatus ¶ added in v0.8.0
type WebhookStatus string
WebhookStatus represents the status of a WebhookRequest
const ( // WebhookStatusSuccess represents that the webhook was successful WebhookStatusSuccess WebhookStatus = "success" // WebhookStatusConnectionError represents that the webhook had a connection error WebhookStatusConnectionError WebhookStatus = "connection_error" // WebhookStatusResponseError represents that the webhook response had a non 2xx status code WebhookStatusResponseError WebhookStatus = "response_error" )
func (WebhookStatus) String ¶ added in v0.8.0
func (r WebhookStatus) String() string