Documentation ¶
Index ¶
- func GroupReferenceValidation(sl validator.StructLevel)
- func LabelReferenceValidation(sl validator.StructLevel)
- func UserReferenceValidation(sl validator.StructLevel)
- type Channel
- type ChannelReference
- type ChannelRole
- type ChannelUUID
- type Classifier
- type ClassifierReference
- type ClassifierUUID
- type Field
- type FieldReference
- type FieldType
- type FieldUUID
- type Flow
- type FlowReference
- type FlowUUID
- type Global
- type GlobalReference
- type Group
- type GroupReference
- type GroupUUID
- type Label
- type LabelReference
- type LabelUUID
- type LocationHierarchy
- type MissingCallback
- type Reference
- type Resthook
- type Source
- type Template
- type TemplateReference
- type TemplateTranslation
- type TemplateUUID
- type Ticketer
- type TicketerReference
- type TicketerUUID
- type Topic
- type TopicReference
- type TopicUUID
- type TypedReference
- type UUIDReference
- type User
- type UserReference
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GroupReferenceValidation ¶
func GroupReferenceValidation(sl validator.StructLevel)
GroupReferenceValidation validates that the given group reference is either a concrete reference or a name matcher
func LabelReferenceValidation ¶
func LabelReferenceValidation(sl validator.StructLevel)
LabelReferenceValidation validates that the given label reference is either a concrete reference or a name matcher
func UserReferenceValidation ¶
func UserReferenceValidation(sl validator.StructLevel)
UserReferenceValidation validates that the given user reference is either a concrete reference or an email matcher
Types ¶
type Channel ¶
type Channel interface { UUID() ChannelUUID Name() string Address() string Schemes() []string Roles() []ChannelRole Parent() *ChannelReference Country() envs.Country MatchPrefixes() []string AllowInternational() bool }
Channel is something that can send/receive messages.
{ "uuid": "14782905-81a6-4910-bc9f-93ad287b23c3", "name": "My Android", "address": "+593979011111", "schemes": ["tel"], "roles": ["send", "receive"], "country": "EC" }
@asset channel
type ChannelReference ¶
type ChannelReference struct { UUID ChannelUUID `json:"uuid" validate:"required,uuid"` Name string `json:"name"` }
ChannelReference is used to reference a channel
func NewChannelReference ¶
func NewChannelReference(uuid ChannelUUID, name string) *ChannelReference
NewChannelReference creates a new channel reference with the given UUID and name
func (*ChannelReference) GenericUUID ¶
func (r *ChannelReference) GenericUUID() uuids.UUID
GenericUUID returns the untyped UUID
func (*ChannelReference) Identity ¶
func (r *ChannelReference) Identity() string
Identity returns the unique identity of the asset
func (*ChannelReference) String ¶
func (r *ChannelReference) String() string
func (*ChannelReference) Type ¶
func (r *ChannelReference) Type() string
Type returns the name of the asset type
func (*ChannelReference) Variable ¶
func (r *ChannelReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type ChannelRole ¶
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 Classifier ¶
type Classifier interface { UUID() ClassifierUUID Name() string Type() string Intents() []string }
Classifier is an NLU classifier.
{ "uuid": "37657cf7-5eab-4286-9cb0-bbf270587bad", "name": "Booking", "type": "wit", "intents": ["book_flight", "book_hotel"] }
@asset classifier
type ClassifierReference ¶
type ClassifierReference struct { UUID ClassifierUUID `json:"uuid" validate:"required,uuid"` Name string `json:"name"` }
ClassifierReference is used to reference a classifier
func NewClassifierReference ¶
func NewClassifierReference(uuid ClassifierUUID, name string) *ClassifierReference
NewClassifierReference creates a new classifier reference with the given UUID and name
func (*ClassifierReference) GenericUUID ¶
func (r *ClassifierReference) GenericUUID() uuids.UUID
GenericUUID returns the untyped UUID
func (*ClassifierReference) Identity ¶
func (r *ClassifierReference) Identity() string
Identity returns the unique identity of the asset
func (*ClassifierReference) String ¶
func (r *ClassifierReference) String() string
func (*ClassifierReference) Type ¶
func (r *ClassifierReference) Type() string
Type returns the name of the asset type
func (*ClassifierReference) Variable ¶
func (r *ClassifierReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type ClassifierUUID ¶
ClassifierUUID is the UUID of an NLU classifier
type Field ¶
Field is a custom contact property.
{ "uuid": "d66a7823-eada-40e5-9a3a-57239d4690bf", "key": "gender", "name": "Gender", "type": "text" }
@asset field
type FieldReference ¶
type FieldReference struct { Key string `json:"key" validate:"required"` Name string `json:"name"` }
FieldReference is a reference to a field
func NewFieldReference ¶
func NewFieldReference(key string, name string) *FieldReference
NewFieldReference creates a new field reference with the given key and name
func (*FieldReference) Identity ¶
func (r *FieldReference) Identity() string
Identity returns the unique identity of the asset
func (*FieldReference) String ¶
func (r *FieldReference) String() string
func (*FieldReference) Type ¶
func (r *FieldReference) Type() string
Type returns the name of the asset type
func (*FieldReference) Variable ¶
func (r *FieldReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type Flow ¶
type Flow interface { UUID() FlowUUID Name() string Definition() json.RawMessage }
Flow is graph of nodes with actions and routers.
{ "uuid": "14782905-81a6-4910-bc9f-93ad287b23c3", "name": "Registration", "definition": { "nodes": [] } }
@asset flow
type FlowReference ¶
type FlowReference struct { UUID FlowUUID `json:"uuid" validate:"required,uuid4"` Name string `json:"name"` }
FlowReference is used to reference a flow from another flow
func NewFlowReference ¶
func NewFlowReference(uuid FlowUUID, name string) *FlowReference
NewFlowReference creates a new flow reference with the given UUID and name
func (*FlowReference) GenericUUID ¶
func (r *FlowReference) GenericUUID() uuids.UUID
GenericUUID returns the untyped UUID
func (*FlowReference) Identity ¶
func (r *FlowReference) Identity() string
Identity returns the unique identity of the asset
func (*FlowReference) String ¶
func (r *FlowReference) String() string
func (*FlowReference) Type ¶
func (r *FlowReference) Type() string
Type returns the name of the asset type
func (*FlowReference) Variable ¶
func (r *FlowReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type Global ¶
Global is a named constant.
{ "key": "organization_name", "name": "Organization Name", "value": "U-Report" }
@asset global
type GlobalReference ¶
type GlobalReference struct { Key string `json:"key" validate:"required"` Name string `json:"name"` }
GlobalReference is a reference to a global
func NewGlobalReference ¶
func NewGlobalReference(key string, name string) *GlobalReference
NewGlobalReference creates a new global reference with the given key and name
func (*GlobalReference) Identity ¶
func (r *GlobalReference) Identity() string
Identity returns the unique identity of the asset
func (*GlobalReference) String ¶
func (r *GlobalReference) String() string
func (*GlobalReference) Type ¶
func (r *GlobalReference) Type() string
Type returns the name of the asset type
func (*GlobalReference) Variable ¶
func (r *GlobalReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type Group ¶
Group is a set of contacts which can be added to and removed from manually, or based on a query.
{ "uuid": "14782905-81a6-4910-bc9f-93ad287b23c3", "name": "Youth", "query": "age <= 18" }
@asset group
type GroupReference ¶
type GroupReference struct { UUID GroupUUID `json:"uuid,omitempty" validate:"omitempty,uuid4"` Name string `json:"name,omitempty"` NameMatch string `json:"name_match,omitempty" engine:"evaluated"` }
GroupReference is used to reference a group
func NewGroupReference ¶
func NewGroupReference(uuid GroupUUID, name string) *GroupReference
NewGroupReference creates a new group reference with the given UUID and name
func NewVariableGroupReference ¶
func NewVariableGroupReference(nameMatch string) *GroupReference
NewVariableGroupReference creates a new group reference from the given templatized name match
func (*GroupReference) GenericUUID ¶
func (r *GroupReference) GenericUUID() uuids.UUID
GenericUUID returns the untyped UUID
func (*GroupReference) Identity ¶
func (r *GroupReference) Identity() string
Identity returns the unique identity of the asset
func (*GroupReference) String ¶
func (r *GroupReference) String() string
func (*GroupReference) Type ¶
func (r *GroupReference) Type() string
Type returns the name of the asset type
func (*GroupReference) Variable ¶
func (r *GroupReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type Label ¶
Label is an organizational tag that can be applied to a message.
{ "uuid": "14782905-81a6-4910-bc9f-93ad287b23c3", "name": "Spam" }
@asset label
type LabelReference ¶
type LabelReference struct { UUID LabelUUID `json:"uuid,omitempty" validate:"omitempty,uuid4"` Name string `json:"name,omitempty"` NameMatch string `json:"name_match,omitempty" engine:"evaluated"` }
LabelReference is used to reference a label
func NewLabelReference ¶
func NewLabelReference(uuid LabelUUID, name string) *LabelReference
NewLabelReference creates a new label reference with the given UUID and name
func NewVariableLabelReference ¶
func NewVariableLabelReference(nameMatch string) *LabelReference
NewVariableLabelReference creates a new label reference from the given templatized name match
func (*LabelReference) GenericUUID ¶
func (r *LabelReference) GenericUUID() uuids.UUID
GenericUUID returns the untyped UUID
func (*LabelReference) Identity ¶
func (r *LabelReference) Identity() string
Identity returns the unique identity of the asset
func (*LabelReference) String ¶
func (r *LabelReference) String() string
func (*LabelReference) Type ¶
func (r *LabelReference) Type() string
Type returns the name of the asset type
func (*LabelReference) Variable ¶
func (r *LabelReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type LocationHierarchy ¶
type LocationHierarchy interface { FindByPath(path envs.LocationPath) *envs.Location FindByName(name string, level envs.LocationLevel, parent *envs.Location) []*envs.Location }
LocationHierarchy is a searchable hierarchy of locations.
{ "name": "Rwanda", "aliases": ["Ruanda"], "children": [ { "name": "Kigali City", "aliases": ["Kigali", "Kigari"], "children": [ { "name": "Gasabo", "children": [ { "id": "575743222", "name": "Gisozi" }, { "id": "457378732", "name": "Ndera" } ] }, { "name": "Nyarugenge", "children": [] } ] }, { "name": "Eastern Province" } ] }
@asset location
type MissingCallback ¶
MissingCallback is callback to be invoked when an asset is missing
var IgnoreMissing MissingCallback = func(Reference, error) {}
IgnoreMissing does nothing if an asset is reported missing
type Resthook ¶
Resthook is a set of URLs which are subscribed to the named event.
{ "slug": "new-registration", "subscribers": [ "http://example.com/record.php?@contact.uuid" ] }
@asset resthook
type Source ¶
type Source interface { Channels() ([]Channel, error) Classifiers() ([]Classifier, error) Fields() ([]Field, error) FlowByUUID(FlowUUID) (Flow, error) FlowByName(string) (Flow, error) Globals() ([]Global, error) Groups() ([]Group, error) Labels() ([]Label, error) Locations() ([]LocationHierarchy, error) Resthooks() ([]Resthook, error) Templates() ([]Template, error) Ticketers() ([]Ticketer, error) Topics() ([]Topic, error) Users() ([]User, error) }
Source is a source of assets
type Template ¶
type Template interface { UUID() TemplateUUID Name() string Translations() []TemplateTranslation }
Template is a message template, currently only used by WhatsApp channels
{ "name": "revive-issue", "uuid": "14782905-81a6-4910-bc9f-93ad287b23c3", "translations": [ { "language": "eng", "content": "Hi {{1}}, are you still experiencing your issue?", "channel": { "uuid": "cf26be4c-875f-4094-9e08-162c3c9dcb5b", "name": "Twilio Channel" } }, { "language": "fra", "content": "Bonjour {{1}}", "channel": { "uuid": "cf26be4c-875f-4094-9e08-162c3c9dcb5b", "name": "Twilio Channel" } } ] }
@asset template
type TemplateReference ¶
type TemplateReference struct { UUID TemplateUUID `json:"uuid" validate:"required,uuid"` Name string `json:"name"` }
TemplateReference is used to reference a Template
func NewTemplateReference ¶
func NewTemplateReference(uuid TemplateUUID, name string) *TemplateReference
NewTemplateReference creates a new template reference with the given UUID and name
func (*TemplateReference) GenericUUID ¶
func (r *TemplateReference) GenericUUID() uuids.UUID
GenericUUID returns the untyped UUID
func (*TemplateReference) Identity ¶
func (r *TemplateReference) Identity() string
Identity returns the unique identity of the asset
func (*TemplateReference) String ¶
func (r *TemplateReference) String() string
func (*TemplateReference) Type ¶
func (r *TemplateReference) Type() string
Type returns the name of the asset type
func (*TemplateReference) Variable ¶
func (r *TemplateReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type TemplateTranslation ¶
type TemplateTranslation interface { Content() string Language() envs.Language Country() envs.Country Namespace() string VariableCount() int MediaIds() []string Category() string Channel() ChannelReference }
TemplateTranslation represents a single translation for a specific template and channel
type Ticketer ¶
type Ticketer interface { UUID() TicketerUUID Name() string Type() string }
Ticketer is a system which can open or close tickets
{ "uuid": "37657cf7-5eab-4286-9cb0-bbf270587bad", "name": "Support Tickets", "type": "mailgun" }
@asset ticketer
type TicketerReference ¶
type TicketerReference struct { UUID TicketerUUID `json:"uuid" validate:"required,uuid"` Name string `json:"name"` }
TicketerReference is used to reference a ticketer
func NewTicketerReference ¶
func NewTicketerReference(uuid TicketerUUID, name string) *TicketerReference
NewTicketerReference creates a new classifier reference with the given UUID and name
func (*TicketerReference) GenericUUID ¶
func (r *TicketerReference) GenericUUID() uuids.UUID
GenericUUID returns the untyped UUID
func (*TicketerReference) Identity ¶
func (r *TicketerReference) Identity() string
Identity returns the unique identity of the asset
func (*TicketerReference) String ¶
func (r *TicketerReference) String() string
func (*TicketerReference) Type ¶
func (r *TicketerReference) Type() string
Type returns the name of the asset type
func (*TicketerReference) Variable ¶
func (r *TicketerReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type Topic ¶
Topic categorizes tickets
{ "uuid": "cd48bd11-08b9-44e3-9778-8e26adf08a7a", "name": "Weather" }
@asset topic
type TopicReference ¶
type TopicReference struct { UUID TopicUUID `json:"uuid" validate:"required,uuid"` Name string `json:"name"` }
TopicReference is used to reference a topic
func NewTopicReference ¶
func NewTopicReference(uuid TopicUUID, name string) *TopicReference
NewTopicReference creates a new topic reference with the given UUID and name
func (*TopicReference) GenericUUID ¶
func (r *TopicReference) GenericUUID() uuids.UUID
GenericUUID returns the untyped UUID
func (*TopicReference) Identity ¶
func (r *TopicReference) Identity() string
Identity returns the unique identity of the asset
func (*TopicReference) String ¶
func (r *TopicReference) String() string
func (*TopicReference) Type ¶
func (r *TopicReference) Type() string
Type returns the name of the asset type
func (*TopicReference) Variable ¶
func (r *TopicReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference
type TypedReference ¶
TypedReference is a utility struct for when we need to serialize a reference with a type
func NewTypedReference ¶
func NewTypedReference(r Reference) TypedReference
NewTypedReference creates a new typed reference
func (TypedReference) MarshalJSON ¶
func (r TypedReference) MarshalJSON() ([]byte, error)
type UUIDReference ¶
UUIDReference is interface for all reference types that contain a UUID
type User ¶
User is an person who can trigger flows or be assigned tickets etc.
{ "email": "bob@nyaruka.com", "name": "Bob" }
@asset user
type UserReference ¶
type UserReference struct { Email string `json:"email,omitempty" validate:"omitempty,email"` Name string `json:"name,omitempty"` EmailMatch string `json:"email_match,omitempty" engine:"evaluated"` }
UserReference is used to reference a user
func NewUserReference ¶
func NewUserReference(email, name string) *UserReference
NewUserReference creates a new user reference with the given key and name
func NewVariableUserReference ¶
func NewVariableUserReference(emailMatch string) *UserReference
NewVariableUserReference creates a new user reference from the given templatized email match
func (*UserReference) Identity ¶
func (r *UserReference) Identity() string
Identity returns the unique identity of the asset
func (*UserReference) String ¶
func (r *UserReference) String() string
func (*UserReference) Type ¶
func (r *UserReference) Type() string
Type returns the name of the asset type
func (*UserReference) UnmarshalJSON ¶
func (r *UserReference) UnmarshalJSON(data []byte) error
UmarshalJSON unmarshals this object from JSON
func (*UserReference) Variable ¶
func (r *UserReference) Variable() bool
Variable returns whether this a variable (vs concrete) reference