Documentation ¶
Index ¶
- Constants
- Variables
- func EnumerateTemplateArray(templates []string, include func(string))
- func EnumerateTemplateTranslations(localization Localization, localizable Localizable, key string, ...)
- func ExtractFieldReferences(template string) []*assets.FieldReference
- func InspectReference(ref assets.Reference, inspect func(Inspectable))
- func IsPossibleLocationPath(str string) bool
- func RewriteTemplateArray(templates []string, rewrite func(string) string)
- func RewriteTemplateTranslations(localization Localization, localizable Localizable, key string, ...)
- 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 CategoryUUID
- type Channel
- func (c *Channel) Asset() assets.Channel
- func (c *Channel) Describe() string
- func (c *Channel) HasParent() bool
- func (c *Channel) HasRole(role assets.ChannelRole) bool
- func (c *Channel) Reduce(env utils.Environment) types.XPrimitive
- func (c *Channel) Reference() *assets.ChannelReference
- func (c *Channel) Resolve(env utils.Environment, key string) types.XValue
- func (c *Channel) String() string
- func (c *Channel) SupportsScheme(scheme string) bool
- func (c *Channel) ToXJSON(env utils.Environment) types.XText
- type ChannelAssets
- type Connection
- type Contact
- func (c *Contact) AddURN(urn *ContactURN) bool
- func (c *Contact) Clone() *Contact
- func (c *Contact) CreatedOn() time.Time
- func (c *Contact) Describe() string
- func (c *Contact) Equal(other *Contact) bool
- 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() ContactID
- 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) PreferredURN() *ContactURN
- func (c *Contact) Reduce(env utils.Environment) types.XPrimitive
- func (c *Contact) ReevaluateDynamicGroups(env utils.Environment, allGroups *GroupAssets) ([]*Group, []*Group, []error)
- func (c *Contact) Reference() *ContactReference
- func (c *Contact) Resolve(env utils.Environment, key string) types.XValue
- func (c *Contact) ResolveDestinations(all bool) []Destination
- func (c *Contact) ResolveQueryKey(env utils.Environment, key string) []interface{}
- func (c *Contact) SetCreatedOn(createdOn time.Time)
- 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) bool
- type ContactID
- type ContactReference
- type ContactURN
- func (u *ContactURN) Channel() *Channel
- func (u *ContactURN) Describe() string
- func (u *ContactURN) Equal(other *ContactURN) bool
- func (u *ContactURN) Reduce(env utils.Environment) types.XPrimitive
- func (u *ContactURN) SetChannel(channel *Channel)
- func (u *ContactURN) String() string
- func (u *ContactURN) ToXJSON(env utils.Environment) types.XText
- func (u *ContactURN) URN() urns.URN
- type ContactUUID
- type Destination
- type Engine
- type Event
- type EventCallback
- type Exit
- type ExitUUID
- type Field
- type FieldAssets
- type FieldValue
- type FieldValues
- func (f FieldValues) Clear(field *Field)
- func (f FieldValues) Context(env utils.Environment) types.XPrimitive
- func (f FieldValues) Get(field *Field) *Value
- func (f FieldValues) Parse(env utils.Environment, fields *FieldAssets, field *Field, rawValue string) *Value
- func (f FieldValues) Set(field *Field, value *Value)
- type Flow
- type FlowAssets
- type FlowRun
- type FlowType
- type Group
- func (g *Group) Asset() assets.Group
- func (g *Group) CheckDynamicMembership(env utils.Environment, contact *Contact) (bool, error)
- func (g *Group) Context() types.XValue
- func (g *Group) IsDynamic() bool
- func (g *Group) ParsedQuery() (*contactql.ContactQuery, error)
- func (g *Group) Reference() *assets.GroupReference
- type GroupAssets
- type GroupList
- type Hint
- type Input
- type InputUUID
- type Inspectable
- type Label
- type LabelAssets
- type LegacyExtraContributor
- type Localizable
- type Localization
- type LocationAssets
- type LocationPath
- type Modifier
- type ModifierCallback
- type MsgID
- type MsgIn
- type MsgOut
- type MsgUUID
- type Node
- type NodeUUID
- type Position
- type Resthook
- type ResthookAssets
- type Result
- type ResultSpec
- 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(result *Result)
- func (r Results) ToXJSON(env utils.Environment) types.XText
- type Resume
- type Router
- type RunEnvironment
- type RunStatus
- type RunSummary
- type RunUUID
- type Session
- type SessionAssets
- type SessionStatus
- type Sprint
- type Step
- type StepUUID
- type Sticky
- type Translations
- type Trigger
- type TriggerWithRun
- type UI
- type UINodeConfig
- type UINodeDetails
- type UINodeType
- type URNList
- type Value
- type Wait
- type WebhookCall
- func (w *WebhookCall) Body() string
- func (w *WebhookCall) BodyIgnored() bool
- func (w *WebhookCall) Method() string
- func (w *WebhookCall) Request() string
- func (w *WebhookCall) Response() string
- func (w *WebhookCall) Resthook() string
- func (w *WebhookCall) Status() WebhookStatus
- func (w *WebhookCall) StatusCode() int
- func (w *WebhookCall) TimeTaken() time.Duration
- func (w *WebhookCall) URL() string
- type WebhookStatus
Constants ¶
const ( LocationLevelState = utils.LocationLevel(1) LocationLevelDistrict = utils.LocationLevel(2) LocationLevelWard = utils.LocationLevel(3) )
location levels which can be field types
const NilMsgID = MsgID(0)
NilMsgID is our constant for nil message ids
Variables ¶
var DefaultWebhookPayload = `` /* 751-byte string literal not displayed */
DefaultWebhookPayload is a template that matches the JSON payload sent by legacy webhooks
var RunContextTopLevels = []string{
"child",
"contact",
"fields",
"input",
"legacy_extra",
"parent",
"results",
"run",
"trigger",
"urns",
}
RunContextTopLevels are the allowed top-level variables for expression evaluations
Functions ¶
func EnumerateTemplateArray ¶ added in v0.29.0
EnumerateTemplateArray enumerates each template in the array
func EnumerateTemplateTranslations ¶ added in v0.29.0
func EnumerateTemplateTranslations(localization Localization, localizable Localizable, key string, include func(string))
func ExtractFieldReferences ¶ added in v0.29.0
func ExtractFieldReferences(template string) []*assets.FieldReference
ExtractFieldReferences extracts fields references from the given template
func InspectReference ¶ added in v0.29.0
func InspectReference(ref assets.Reference, inspect func(Inspectable))
InspectReference inspects the given asset reference if it's non-nil
func IsPossibleLocationPath ¶ added in v0.9.6
IsPossibleLocationPath returns whether the given string could be a location path
func RewriteTemplateArray ¶ added in v0.29.0
RewriteTemplateArray rewrites each template in the array
func RewriteTemplateTranslations ¶ added in v0.29.0
func RewriteTemplateTranslations(localization Localization, localizable Localizable, key string, rewrite func(string) string)
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 { utils.Typed Localizable Inspectable UUID() ActionUUID Execute(FlowRun, Step, ModifierCallback, EventCallback) error Validate() error AllowedFlowTypes() []FlowType }
Action is an action within a flow node
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:
@(input.attachments[0].content_type) -> image/jpeg @(input.attachments[0].url) -> http://s3.amazon.com/bucket/test.jpg @(json(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"` ID_ MsgID `json:"id,omitempty"` URN_ urns.URN `json:"urn,omitempty" validate:"omitempty,urn"` Channel_ *assets.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() *assets.ChannelReference
Channel returns the channel of this message
type CategoryUUID ¶ added in v0.30.2
CategoryUUID is the UUID of a node category
type Channel ¶
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 @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 (*Channel) Describe ¶ added in v0.15.0
Describe returns a representation of this type for error messages
func (*Channel) HasRole ¶ added in v0.6.0
func (c *Channel) HasRole(role assets.ChannelRole) bool
HasRole returns whether this channel has the given role
func (*Channel) Reduce ¶ added in v0.15.0
func (c *Channel) Reduce(env utils.Environment) types.XPrimitive
Reduce is called when this object needs to be reduced to a primitive
func (*Channel) Reference ¶ added in v0.5.0
func (c *Channel) Reference() *assets.ChannelReference
Reference returns a reference to this channel
func (*Channel) Resolve ¶
Resolve resolves the given key when this channel is referenced in an expression
func (*Channel) SupportsScheme ¶ added in v0.6.0
SupportsScheme returns whether this channel supports the given URN scheme
type ChannelAssets ¶ added in v0.15.0
type ChannelAssets struct {
// contains filtered or unexported fields
}
ChannelAssets provides access to all channel assets
func NewChannelAssets ¶ added in v0.15.0
func NewChannelAssets(channels []assets.Channel) *ChannelAssets
NewChannelAssets creates a new set of channel assets
func (*ChannelAssets) Get ¶ added in v0.15.0
func (s *ChannelAssets) Get(uuid assets.ChannelUUID) *Channel
Get returns the channel with the given UUID
func (*ChannelAssets) GetForURN ¶ added in v0.15.0
func (s *ChannelAssets) GetForURN(urn *ContactURN, role assets.ChannelRole) *Channel
GetForURN returns the best channel for the given URN
type Connection ¶ added in v0.25.0
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a connection to a specific channel using a specific URN
func NewConnection ¶ added in v0.25.0
func NewConnection(channel *assets.ChannelReference, urn urns.URN) *Connection
NewConnection creates a new connection
func (*Connection) Channel ¶ added in v0.25.0
func (c *Connection) Channel() *assets.ChannelReference
func (*Connection) MarshalJSON ¶ added in v0.25.2
func (c *Connection) MarshalJSON() ([]byte, error)
MarshalJSON marshals this connection into JSON
func (*Connection) URN ¶ added in v0.25.0
func (c *Connection) URN() urns.URN
func (*Connection) UnmarshalJSON ¶ added in v0.25.2
func (c *Connection) UnmarshalJSON(data []byte) error
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.urn -> tel:+12065551212 @(extract(contact.groups, "name")) -> [Testers, Males] @contact.fields -> {activation_token: AACC55, age: 23, gender: Male, join_date: 2017-12-02T00:00:00.000000-02:00, not_set: } @contact.fields.activation_token -> AACC55 @contact.fields.gender -> Male
@context contact
func NewContact ¶ added in v0.5.1
func NewContact( sa SessionAssets, uuid ContactUUID, id ContactID, name string, language utils.Language, timezone *time.Location, createdOn time.Time, urns []urns.URN, groups []assets.Group, fields map[string]*Value) (*Contact, error)
NewContact creates a new contact with the passed in attributes
func NewEmptyContact ¶ added in v0.14.7
func NewEmptyContact(sa SessionAssets, name string, language utils.Language, timezone *time.Location) *Contact
NewEmptyContact creates a new empy contact with the passed in name, language and location
func ReadContact ¶
func ReadContact(sa SessionAssets, data json.RawMessage, missing assets.MissingCallback) (*Contact, error)
ReadContact decodes a contact from the passed in JSON
func (*Contact) AddURN ¶ added in v0.4.0
func (c *Contact) AddURN(urn *ContactURN) bool
AddURN adds a new URN to this contact
func (*Contact) Describe ¶ added in v0.10.1
Describe returns a representation of this type for error messages
func (*Contact) Equal ¶ added in v0.20.0
Equal returns true if this instance is equal to the given instance
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 channel we would use for sending
func (*Contact) PreferredURN ¶ added in v0.27.5
func (c *Contact) PreferredURN() *ContactURN
PreferredURN gets the preferred URN for this contact, i.e. the URN we would use for sending
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
func (c *Contact) ReevaluateDynamicGroups(env utils.Environment, allGroups *GroupAssets) ([]*Group, []*Group, []error)
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) ResolveDestinations ¶ added in v0.27.5
func (c *Contact) ResolveDestinations(all bool) []Destination
ResolveDestinations resolves possible URN/channel destinations
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) 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 and returns whether any change was made
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
func (*ContactReference) Identity ¶ added in v0.29.0
func (r *ContactReference) Identity() string
Identity returns the unique identity of the asset
func (*ContactReference) String ¶ added in v0.29.0
func (r *ContactReference) String() string
func (*ContactReference) Type ¶ added in v0.29.0
func (r *ContactReference) Type() string
Type returns the name of the asset type
func (*ContactReference) Variable ¶ added in v0.29.0
func (r *ContactReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type ContactURN ¶ added in v0.6.0
type ContactURN struct {
// contains filtered or unexported fields
}
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_
To render a URN in a human friendly format, use the [function:format_urn] function.
Examples:
@(urns.tel) -> tel:+12065551212 @(urn_parts(urns.tel).scheme) -> tel @(format_urn(urns.tel)) -> (206) 555-1212 @(json(contact.urns[0])) -> "tel:+12065551212"
@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 ParseRawURN ¶ added in v0.23.0
func ParseRawURN(ca *ChannelAssets, rawURN urns.URN, missing assets.MissingCallback) (*ContactURN, error)
ParseRawURN converts a raw URN to a ContactURN by extracting it's channel reference
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) Equal ¶ added in v0.23.0
func (u *ContactURN) Equal(other *ContactURN) bool
Equal determines if this URN is equal to another
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) SetChannel ¶ added in v0.6.0
func (u *ContactURN) SetChannel(channel *Channel)
SetChannel sets the channel associated with this URN
func (*ContactURN) String ¶ added in v0.6.0
func (u *ContactURN) String() string
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(...))
func (*ContactURN) URN ¶ added in v0.23.0
func (u *ContactURN) URN() urns.URN
URN gets the underlying URN
type Destination ¶ added in v0.27.5
type Destination struct { Channel *Channel URN *ContactURN }
Destination is a sendable channel and URN pair
type Engine ¶ added in v0.27.4
type Engine interface { NewSession(SessionAssets) Session ReadSession(SessionAssets, json.RawMessage, assets.MissingCallback) (Session, error) HTTPClient() *utils.HTTPClient DisableWebhooks() bool MaxWebhookResponseBytes() int MaxStepsPerSprint() int }
type Event ¶
type Event interface { utils.Typed CreatedOn() time.Time StepUUID() StepUUID SetStepUUID(StepUUID) }
Event describes a state change
type EventCallback ¶ added in v0.26.0
type EventCallback func(Event)
EventCallback is a callback invoked when an event has been generated
type Field ¶
Field represents a contact field
func (*Field) Reference ¶ added in v0.24.0
func (f *Field) Reference() *assets.FieldReference
Reference returns a reference to this field
type FieldAssets ¶ added in v0.15.0
type FieldAssets struct {
// contains filtered or unexported fields
}
FieldAssets provides access to all field assets
func NewFieldAssets ¶ added in v0.15.0
func NewFieldAssets(fields []assets.Field) *FieldAssets
NewFieldAssets creates a new set of field assets
func (*FieldAssets) All ¶ added in v0.15.0
func (s *FieldAssets) All() []*Field
All returns all the fields in this set
func (*FieldAssets) FirstOfType ¶ added in v0.15.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.15.0
func (s *FieldAssets) Get(key string) *Field
Get returns the contact field with the given key
type FieldValue ¶ added in v0.4.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.4.0
func NewFieldValue(field *Field, value *Value) *FieldValue
NewFieldValue creates a new field value
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) 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) 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 or nil if there is no value in that type
type FieldValues ¶ added in v0.4.0
type FieldValues map[string]*FieldValue
FieldValues is the set of all field values for a contact
func NewFieldValues ¶ added in v0.15.2
func NewFieldValues(a SessionAssets, values map[string]*Value, missing assets.MissingCallback) (FieldValues, error)
NewFieldValues creates a new field value map
func (FieldValues) Clear ¶ added in v0.19.2
func (f FieldValues) Clear(field *Field)
Clear clears the value set for the given field
func (FieldValues) Context ¶ added in v0.30.4
func (f FieldValues) Context(env utils.Environment) types.XPrimitive
Context returns a representation of this object for use in expressions
func (FieldValues) Get ¶ added in v0.19.2
func (f FieldValues) Get(field *Field) *Value
Get gets the value set for the given field
func (FieldValues) Parse ¶ added in v0.24.0
func (f FieldValues) Parse(env utils.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.19.2
func (f FieldValues) Set(field *Field, value *Value)
Set sets the value for the given field (can be null to clear it)
type Flow ¶
type Flow interface { types.XValue types.XResolvable // spec properties UUID() assets.FlowUUID Name() string Revision() int Language() utils.Language Type() FlowType ExpireAfterMinutes() int Localization() Localization // optional spec properties UI() UI Validate(SessionAssets) error ValidateRecursively(SessionAssets, func(assets.Reference)) error Nodes() []Node GetNode(uuid NodeUUID) Node Reference() *assets.FlowReference ExtractTemplates() []string RewriteTemplates(func(string) string) ExtractDependencies() []assets.Reference ExtractResults() []*ResultSpec }
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 FlowRun ¶
type FlowRun interface { types.XValue types.XResolvable RunSummary Environment() RunEnvironment Session() Session Context() types.XValue SaveResult(*Result) SetStatus(RunStatus) LogEvent(Step, Event) LogError(Step, error) CreateStep(Node) Step Path() []Step PathLocation() (Step, Node, error) Events() []Event EvaluateTemplateValue(template string) (types.XValue, error) EvaluateTemplate(template string) (string, error) GetText(utils.UUID, string, string) string GetTextArray(utils.UUID, string, []string) []string GetTranslatedTextArray(utils.UUID, string, []string, []utils.Language) []string Snapshot() RunSummary Parent() RunSummary ParentInSession() FlowRun Ancestors() []FlowRun CreatedOn() time.Time ModifiedOn() 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. `results.age`
Examples:
@run.flow.name -> Registration
@context run
type FlowType ¶ added in v0.14.0
type FlowType string
FlowType represents the different types of flows
const ( // FlowTypeMessaging is a flow that is run over a messaging channel FlowTypeMessaging FlowType = "messaging" // FlowTypeMessagingOffline is a flow which is run over an offline messaging client like Surveyor FlowTypeMessagingOffline FlowType = "messaging_offline" // FlowTypeVoice is a flow which is run over IVR FlowTypeVoice FlowType = "voice" )
type Group ¶
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:
@(extract(contact.groups, "name")) -> [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 (*Group) CheckDynamicMembership ¶ added in v0.4.0
CheckDynamicMembership returns whether the given contact belongs in this dynamic group
func (*Group) Context ¶ added in v0.31.0
Context is called when this object is accessed in an expression
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) Reference ¶ added in v0.4.0
func (g *Group) Reference() *assets.GroupReference
Reference returns a reference to this group
type GroupAssets ¶ added in v0.15.0
type GroupAssets struct {
// contains filtered or unexported fields
}
GroupAssets provides access to all group assets
func NewGroupAssets ¶ added in v0.15.0
func NewGroupAssets(groups []assets.Group) *GroupAssets
NewGroupAssets creates a new set of group assets
func (*GroupAssets) All ¶ added in v0.15.0
func (s *GroupAssets) All() []*Group
All returns all the groups
func (*GroupAssets) FindByName ¶ added in v0.15.0
func (s *GroupAssets) FindByName(name string) *Group
FindByName looks for a group with the given name (case-insensitive)
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 NewGroupListFromAssets ¶ added in v0.15.2
func NewGroupListFromAssets(a SessionAssets, groupAssets []assets.Group) (*GroupList, error)
NewGroupListFromAssets creates a new group list
func (GroupList) Context ¶ added in v0.31.0
Context is called when this object needs to be reduced to a primitive
func (*GroupList) FindByUUID ¶ added in v0.4.0
FindByUUID returns the group with the passed in UUID or nil if not found
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:
@input -> Hi there\nhttp://s3.amazon.com/bucket/test.jpg\nhttp://s3.amazon.com/bucket/test.mp3 @input.type -> msg @input.text -> Hi there @input.attachments -> [http://s3.amazon.com/bucket/test.jpg, http://s3.amazon.com/bucket/test.mp3] @(json(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":"2017-12-31T11:35:10.035757-02:00","text":"Hi there","type":"msg","urn":"tel:+12065551212","uuid":"9bf91c2b-ce58-4cef-aacc-281e03f69ab5"}
@context input
type Inspectable ¶ added in v0.29.0
type Inspectable interface { Inspect(func(Inspectable)) EnumerateTemplates(Localization, func(string)) RewriteTemplates(Localization, func(string) string) EnumerateDependencies(Localization, func(assets.Reference)) EnumerateResults(func(*ResultSpec)) }
Inspectable is implemented by various flow components to allow walking the definition and extracting things like dependencies
type Label ¶
Label represents a message label
func (*Label) Reference ¶ added in v0.4.0
func (l *Label) Reference() *assets.LabelReference
Reference returns a reference to this label
type LabelAssets ¶ added in v0.15.0
type LabelAssets struct {
// contains filtered or unexported fields
}
LabelAssets provides access to all label assets
func NewLabelAssets ¶ added in v0.15.0
func NewLabelAssets(labels []assets.Label) *LabelAssets
NewLabelAssets creates a new set of label assets
func (*LabelAssets) All ¶ added in v0.15.0
func (s *LabelAssets) All() []*Label
All returns all the labels
func (*LabelAssets) FindByName ¶ added in v0.15.0
func (s *LabelAssets) FindByName(name string) *Label
FindByName looks for a label with the given name (case-insensitive)
type LegacyExtraContributor ¶ added in v0.21.3
type LegacyExtraContributor interface {
LegacyExtra() Results
}
LegacyExtraContributor is something which contributes results for constructing @legacy_extra
type Localizable ¶ added in v0.29.0
type Localization ¶ added in v0.6.2
type Localization interface { AddItemTranslation(utils.Language, utils.UUID, string, []string) GetTranslations(utils.Language) Translations Languages() []utils.Language }
Localization provide a way to get the translations for a specific language
type LocationAssets ¶ added in v0.15.0
type LocationAssets struct {
// contains filtered or unexported fields
}
LocationAssets provides access to location assets
func NewLocationAssets ¶ added in v0.15.0
func NewLocationAssets(hierarchies []assets.LocationHierarchy) *LocationAssets
NewLocationAssets creates a new set of location assets
func (*LocationAssets) Hierarchies ¶ added in v0.15.0
func (s *LocationAssets) Hierarchies() []assets.LocationHierarchy
Hierarchies returns all hierarchies
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 Modifier ¶ added in v0.24.0
type Modifier interface { utils.Typed Apply(utils.Environment, SessionAssets, *Contact, EventCallback) }
Modifier is something which can modify a contact
type ModifierCallback ¶ added in v0.26.0
type ModifierCallback func(Modifier)
ModifierCallback is a callback invoked when a modifier has been generated
type MsgIn ¶
MsgIn represents a incoming message from the session contact
func NewMsgIn ¶ added in v0.6.0
func NewMsgIn(uuid MsgUUID, urn urns.URN, channel *assets.ChannelReference, text string, attachments []Attachment) *MsgIn
NewMsgIn creates a new incoming message
func (*MsgIn) ExternalID ¶ added in v0.24.0
ExternalID returns the optional external ID of this incoming message
func (*MsgIn) SetExternalID ¶ added in v0.24.0
SetExternalID sets the external ID of this message
type MsgOut ¶
MsgOut represents a outgoing message to the session contact
func NewMsgOut ¶ added in v0.6.0
func NewMsgOut(urn urns.URN, channel *assets.ChannelReference, 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 { Inspectable UUID() NodeUUID Actions() []Action Router() Router Exits() []Exit Wait() Wait AddAction(Action) SetRouter(Router) Validate(Flow, map[utils.UUID]bool) error }
Node is a single node in a flow
type Resthook ¶ added in v0.10.20
Resthook represents a named event and a set of subscribers
func NewResthook ¶ added in v0.10.20
NewResthook returns a new resthook object
type ResthookAssets ¶ added in v0.15.0
type ResthookAssets struct {
// contains filtered or unexported fields
}
ResthookAssets provides access to all resthook assets
func NewResthookAssets ¶ added in v0.15.0
func NewResthookAssets(resthooks []assets.Resthook) *ResthookAssets
NewResthookAssets creates a new set of resthook assets
func (*ResthookAssets) FindBySlug ¶ added in v0.15.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"` 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"` Extra json.RawMessage `json:"extra,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:
@results.favorite_color -> red @results.favorite_color.value -> red @results.favorite_color.category -> Red
@context result
func NewResult ¶ added in v0.21.1
func NewResult(name string, value string, category string, categoryLocalized string, nodeUUID NodeUUID, input *string, extra json.RawMessage, createdOn time.Time) *Result
NewResult creates a new 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 ResultSpec ¶ added in v0.30.2
type ResultSpec struct { Key string `json:"key"` Name string `json:"name"` Categories []string `json:"categories,omitempty"` }
ResultSpec is possible result that a flow might generate
func MergeResultSpecs ¶ added in v0.30.2
func MergeResultSpecs(specs []*ResultSpec) []*ResultSpec
MergeResultSpecs merges result specs based on key
func NewResultSpec ¶ added in v0.30.2
func NewResultSpec(name string, categories []string) *ResultSpec
NewResultSpec creates a new result spec
func (*ResultSpec) String ¶ added in v0.30.2
func (r *ResultSpec) String() string
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 Resume ¶ added in v0.20.0
type Resume interface { utils.Typed Apply(FlowRun, EventCallback) error Environment() utils.Environment Contact() *Contact ResumedOn() time.Time }
Resume represents something which can resume a session with the flow engine
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 Type() FlowType SetType(FlowType) Environment() utils.Environment SetEnvironment(utils.Environment) Contact() *Contact SetContact(*Contact) Input() Input SetInput(Input) Status() SessionStatus Trigger() Trigger PushFlow(Flow, FlowRun, bool) Wait() Wait Start(Trigger) (Sprint, error) Resume(Resume) (Sprint, error) Runs() []FlowRun GetRun(RunUUID) (FlowRun, error) GetCurrentChild(FlowRun) FlowRun ParentRun() RunSummary Engine() Engine }
Session represents the session of a flow run which may contain many runs
type SessionAssets ¶ added in v0.4.0
type SessionAssets interface { Channels() *ChannelAssets Fields() *FieldAssets Flows() FlowAssets Groups() *GroupAssets Labels() *LabelAssets Locations() *LocationAssets Resthooks() *ResthookAssets Validate(flowUUID assets.FlowUUID) ([]assets.Reference, 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" )
type Sprint ¶ added in v0.24.0
type Sprint interface { Modifiers() []Modifier LogModifier(Modifier) Events() []Event LogEvent(Event) }
Sprint is an interaction with the engine - i.e. a start or resume of a session
type Translations ¶
type Translations interface { GetTextArray(utils.UUID, string) []string SetTextArray(utils.UUID, string, []string) }
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 Initialize(Session, EventCallback) error InitializeRun(FlowRun, EventCallback) error Environment() utils.Environment Flow() *assets.FlowReference Contact() *Contact Connection() *Connection 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 TriggerWithRun ¶ added in v0.24.0
type TriggerWithRun interface { Trigger RunSummary() json.RawMessage }
TriggerWithRun is special case of trigger that provides a parent run to the session
type UI ¶ added in v0.15.1
type UI interface { AddNode(uuid NodeUUID, details UINodeDetails) AddSticky(sticky Sticky) GetNode(uuid NodeUUID) UINodeDetails }
UI is a optional section in a flow definition with editor specific information
type UINodeConfig ¶ added in v0.15.1
type UINodeConfig map[string]interface{}
UINodeConfig contains config unique to its type
type UINodeDetails ¶ added in v0.15.1
type UINodeDetails interface {
Position() Position
}
UINodeDetails is the top level ui details for a node
type UINodeType ¶ added in v0.15.1
type UINodeType string
UINodeType tells the editor how to render a particular node
type URNList ¶
type URNList []*ContactURN
URNList is the list of a contact's URNs
func ReadURNList ¶ added in v0.6.0
func ReadURNList(a SessionAssets, rawURNs []urns.URN, missing assets.MissingCallback) (URNList, error)
ReadURNList parses contact URN list from the given list of raw URNs
func (URNList) Context ¶ added in v0.31.0
Context returns this as an XArray - exposed in expressions as @contact.urns, @parent.contact.urns etc
func (URNList) MapContext ¶ added in v0.31.0
MapContext returns a map of the highest priority URN for each scheme - exposed in expressions as @urns
func (URNList) WithScheme ¶ added in v0.4.4
WithScheme returns a new URN list containing of only URNs of the given scheme
type Value ¶ added in v0.15.2
type Value struct { Text types.XText `json:"text" validate:"required"` Datetime *types.XDateTime `json:"datetime,omitempty"` Number *types.XNumber `json:"number,omitempty"` State LocationPath `json:"state,omitempty"` District LocationPath `json:"district,omitempty"` Ward LocationPath `json:"ward,omitempty"` }
Value represents a value in each of the field types
func NewValue ¶ added in v0.15.2
func NewValue(text types.XText, datetime *types.XDateTime, number *types.XNumber, state LocationPath, district LocationPath, ward LocationPath) *Value
NewValue creates an empty value
type WebhookCall ¶ added in v0.8.0
type WebhookCall struct {
// contains filtered or unexported fields
}
WebhookCall is a call made to an external service
func MakeWebhookCall ¶ added in v0.8.0
MakeWebhookCall fires the passed in http request, returning any errors encountered. RequestResponse is always set regardless of any errors being set
func (*WebhookCall) Body ¶ added in v0.8.0
func (w *WebhookCall) Body() string
Body returns the response body
func (*WebhookCall) BodyIgnored ¶ added in v0.27.7
func (w *WebhookCall) BodyIgnored() bool
BodyIgnored returns whether we ignored the body because we didn't recognize the content type
func (*WebhookCall) Method ¶ added in v0.9.3
func (w *WebhookCall) Method() string
Method returns the full HTTP method
func (*WebhookCall) Request ¶ added in v0.8.0
func (w *WebhookCall) Request() string
Request returns the request trace
func (*WebhookCall) Response ¶ added in v0.8.0
func (w *WebhookCall) Response() string
Response returns the response trace
func (*WebhookCall) Resthook ¶ added in v0.23.0
func (w *WebhookCall) Resthook() string
Resthook returns the resthook slug (if this call came from a resthook action)
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) TimeTaken ¶ added in v0.20.0
func (w *WebhookCall) TimeTaken() time.Duration
TimeTaken returns the time taken to make the request
func (*WebhookCall) URL ¶ added in v0.8.0
func (w *WebhookCall) URL() string
URL returns the full URL
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" // WebhookStatusSubscriberGone represents a special state of resthook responses which indicate the caller must remove that subscriber WebhookStatusSubscriberGone WebhookStatus = "subscriber_gone" )
func WebhookStatusFromCode ¶ added in v0.17.0
func WebhookStatusFromCode(code int, isResthook bool) WebhookStatus
WebhookStatusFromCode determines the webhook status from the HTTP status code
func (WebhookStatus) String ¶ added in v0.8.0
func (r WebhookStatus) String() string