Documentation ¶
Overview ¶
Package static is an implementation of Source which loads assets from a static JSON file.
Index ¶
- func NewChannel(uuid assets.ChannelUUID, name string, address string, schemes []string, ...) assets.Channel
- func NewClassifier(uuid assets.ClassifierUUID, name string, type_ string, intents []string) assets.Classifier
- func NewField(uuid assets.FieldUUID, key string, name string, valueType assets.FieldType) assets.Field
- func NewFlow(uuid assets.FlowUUID, name string, definition json.RawMessage) assets.Flow
- func NewGlobal(key, name, value string) assets.Global
- func NewGroup(uuid assets.GroupUUID, name string, query string) assets.Group
- func NewLabel(uuid assets.LabelUUID, name string) assets.Label
- func NewResthook(slug string, subscribers []string) assets.Resthook
- func NewTelChannel(uuid assets.ChannelUUID, name string, address string, ...) assets.Channel
- func NewTicketer(uuid assets.TicketerUUID, name string, type_ string) assets.Ticketer
- func NewTopic(uuid assets.TopicUUID, name string) assets.Topic
- func NewUser(email, name string) assets.User
- type Channel
- func (c *Channel) Address() string
- func (c *Channel) AllowInternational() bool
- func (c *Channel) Country() envs.Country
- func (c *Channel) MatchPrefixes() []string
- func (c *Channel) Name() string
- func (c *Channel) Parent() *assets.ChannelReference
- func (c *Channel) Roles() []assets.ChannelRole
- func (c *Channel) Schemes() []string
- func (c *Channel) UUID() assets.ChannelUUID
- type Classifier
- type Field
- type Flow
- type Global
- type Group
- type Label
- type Resthook
- type StaticSource
- func (s *StaticSource) Channels() ([]assets.Channel, error)
- func (s *StaticSource) Classifiers() ([]assets.Classifier, error)
- func (s *StaticSource) Fields() ([]assets.Field, error)
- func (s *StaticSource) FlowByName(name string) (assets.Flow, error)
- func (s *StaticSource) FlowByUUID(uuid assets.FlowUUID) (assets.Flow, error)
- func (s *StaticSource) Globals() ([]assets.Global, error)
- func (s *StaticSource) Groups() ([]assets.Group, error)
- func (s *StaticSource) Labels() ([]assets.Label, error)
- func (s *StaticSource) Locations() ([]assets.LocationHierarchy, error)
- func (s *StaticSource) Resthooks() ([]assets.Resthook, error)
- func (s *StaticSource) Templates() ([]assets.Template, error)
- func (s *StaticSource) Ticketers() ([]assets.Ticketer, error)
- func (s *StaticSource) Topics() ([]assets.Topic, error)
- func (s *StaticSource) Users() ([]assets.User, error)
- type Template
- type TemplateTranslation
- func (t *TemplateTranslation) Channel() assets.ChannelReference
- func (t *TemplateTranslation) Content() string
- func (t *TemplateTranslation) Country() envs.Country
- func (t *TemplateTranslation) Language() envs.Language
- func (t *TemplateTranslation) MarshalJSON() ([]byte, error)
- func (t *TemplateTranslation) Namespace() string
- func (t *TemplateTranslation) UnmarshalJSON(data []byte) error
- func (t *TemplateTranslation) VariableCount() int
- type Ticketer
- type Topic
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewChannel ¶ added in v0.115.3
func NewChannel(uuid assets.ChannelUUID, name string, address string, schemes []string, roles []assets.ChannelRole, parent *assets.ChannelReference) assets.Channel
NewChannel creates a new channel
func NewClassifier ¶ added in v0.115.3
func NewClassifier(uuid assets.ClassifierUUID, name string, type_ string, intents []string) assets.Classifier
NewClassifier creates a new classifier
func NewField ¶ added in v0.115.3
func NewField(uuid assets.FieldUUID, key string, name string, valueType assets.FieldType) assets.Field
NewField creates a new field from the passed in key, name and type
func NewFlow ¶ added in v0.115.3
NewFlow creates a new flow from the passed in UUID, name and definition
func NewGroup ¶ added in v0.115.3
NewGroup creates a new group from the passed in UUID, name and query
func NewResthook ¶ added in v0.115.3
NewResthook creates a new resthook
func NewTelChannel ¶ added in v0.115.3
func NewTelChannel(uuid assets.ChannelUUID, name string, address string, roles []assets.ChannelRole, parent *assets.ChannelReference, country envs.Country, matchPrefixes []string, allowInternational bool) assets.Channel
NewTelChannel creates a new tel channel
func NewTicketer ¶ added in v0.115.3
NewTicketer creates a new ticketer
Types ¶
type Channel ¶ added in v0.115.3
type Channel struct { UUID_ assets.ChannelUUID `json:"uuid" validate:"required,uuid"` Name_ string `json:"name"` Address_ string `json:"address"` Schemes_ []string `json:"schemes" validate:"min=1"` Roles_ []assets.ChannelRole `json:"roles" validate:"min=1,dive,eq=send|eq=receive|eq=call|eq=answer|eq=ussd"` Parent_ *assets.ChannelReference `json:"parent" validate:"omitempty,dive"` Country_ envs.Country `json:"country,omitempty"` MatchPrefixes_ []string `json:"match_prefixes,omitempty"` AllowInternational_ bool `json:"allow_international,omitempty"` }
Channel is a JSON serializable implementation of a channel asset
func (*Channel) AllowInternational ¶ added in v0.115.3
AllowInternational returns whether this channel allows sending internationally (only applies to TEL schemes)
func (*Channel) Country ¶ added in v0.115.3
Country returns this channel's associated country code (if any)
func (*Channel) MatchPrefixes ¶ added in v0.115.3
MatchPrefixes returns this channel's match prefixes values used for selecting a channel for a URN (if any)
func (*Channel) Parent ¶ added in v0.115.3
func (c *Channel) Parent() *assets.ChannelReference
Parent returns a reference to this channel's parent (if any)
func (*Channel) Roles ¶ added in v0.115.3
func (c *Channel) Roles() []assets.ChannelRole
Roles returns the roles of this channel
func (*Channel) UUID ¶ added in v0.115.3
func (c *Channel) UUID() assets.ChannelUUID
UUID returns the UUID of this channel
type Classifier ¶ added in v0.115.3
type Classifier struct { UUID_ assets.ClassifierUUID `json:"uuid" validate:"required,uuid"` Name_ string `json:"name"` Type_ string `json:"type"` Intents_ []string `json:"intents"` }
Classifier is a JSON serializable implementation of a classifier asset
func (*Classifier) Intents ¶ added in v0.115.3
func (c *Classifier) Intents() []string
Intents returns the intents of this classifier
func (*Classifier) Name ¶ added in v0.115.3
func (c *Classifier) Name() string
Name returns the name of this channel
func (*Classifier) Type ¶ added in v0.115.3
func (c *Classifier) Type() string
Type returns the type of this classifier
func (*Classifier) UUID ¶ added in v0.115.3
func (c *Classifier) UUID() assets.ClassifierUUID
UUID returns the UUID of this channel
type Field ¶ added in v0.115.3
type Field struct { UUID_ assets.FieldUUID `json:"uuid"` Key_ string `json:"key" validate:"required"` Name_ string `json:"name"` Type_ assets.FieldType `json:"type" validate:"required"` }
Field is a JSON serializable implementation of a field asset
type Flow ¶ added in v0.115.3
type Flow struct { UUID_ assets.FlowUUID `json:"uuid" validate:"required,uuid4"` Name_ string `json:"name"` Definition_ json.RawMessage }
Flow is a JSON serializable implementation of a flow asset
func (*Flow) Definition ¶ added in v0.115.3
func (f *Flow) Definition() json.RawMessage
func (*Flow) UnmarshalJSON ¶ added in v0.115.3
type Global ¶ added in v0.115.3
type Global struct { Key_ string `json:"key" validate:"required"` Name_ string `json:"name"` Value_ string `json:"value"` }
Global is a JSON serializable implementation of a global asset
type Group ¶ added in v0.115.3
type Group struct { UUID_ assets.GroupUUID `json:"uuid" validate:"required,uuid4"` Name_ string `json:"name"` Query_ string `json:"query,omitempty"` }
Group is a JSON serializable implementation of a group asset
type Label ¶ added in v0.115.3
type Label struct { UUID_ assets.LabelUUID `json:"uuid" validate:"required,uuid4"` Name_ string `json:"name"` }
Label is a JSON serializable implementation of a label asset
type Resthook ¶ added in v0.115.3
type Resthook struct { Slug_ string `json:"slug" validate:"required"` Subscribers_ []string `json:"subscribers" validate:"required,dive,url"` }
Resthook is a JSON serializable implementation of a resthook asset
func (*Resthook) Subscribers ¶ added in v0.115.3
Subscribers returns the subscribers to the resthook
type StaticSource ¶
type StaticSource struct {
// contains filtered or unexported fields
}
StaticSource is an asset source which loads assets from a static JSON file
func LoadSource ¶ added in v0.115.3
func LoadSource(path string) (*StaticSource, error)
LoadSource loads a new static source from the given JSON file
func NewEmptySource ¶ added in v0.115.3
func NewEmptySource() *StaticSource
NewEmptySource creates a new empty source with no assets
func NewSource ¶ added in v0.115.3
func NewSource(data json.RawMessage) (*StaticSource, error)
NewSource creates a new static source from the given JSON
func (*StaticSource) Channels ¶
func (s *StaticSource) Channels() ([]assets.Channel, error)
Channels returns all channel assets
func (*StaticSource) Classifiers ¶ added in v0.115.3
func (s *StaticSource) Classifiers() ([]assets.Classifier, error)
Classifiers returns all classifier assets
func (*StaticSource) Fields ¶
func (s *StaticSource) Fields() ([]assets.Field, error)
Fields returns all field assets
func (*StaticSource) FlowByName ¶ added in v0.115.3
func (s *StaticSource) FlowByName(name string) (assets.Flow, error)
Flow returns the flow asset with the given UUID
func (*StaticSource) FlowByUUID ¶ added in v0.115.3
Flow returns the flow asset with the given UUID
func (*StaticSource) Globals ¶ added in v0.115.3
func (s *StaticSource) Globals() ([]assets.Global, error)
Globals returns all global assets
func (*StaticSource) Groups ¶
func (s *StaticSource) Groups() ([]assets.Group, error)
Groups returns all group assets
func (*StaticSource) Labels ¶
func (s *StaticSource) Labels() ([]assets.Label, error)
Labels returns all label assets
func (*StaticSource) Locations ¶
func (s *StaticSource) Locations() ([]assets.LocationHierarchy, error)
Locations returns all location assets
func (*StaticSource) Resthooks ¶
func (s *StaticSource) Resthooks() ([]assets.Resthook, error)
Resthooks returns all resthook assets
func (*StaticSource) Templates ¶ added in v0.115.3
func (s *StaticSource) Templates() ([]assets.Template, error)
Templates returns all template assets
func (*StaticSource) Ticketers ¶ added in v0.115.3
func (s *StaticSource) Ticketers() ([]assets.Ticketer, error)
Ticketers returns all ticketer assets
type Template ¶ added in v0.115.3
type Template struct {
// contains filtered or unexported fields
}
Template is a JSON serializable implementation of a template asset
func NewTemplate ¶ added in v0.115.3
func NewTemplate(uuid assets.TemplateUUID, name string, translations []*TemplateTranslation) *Template
NewTemplate creates a new template
func (*Template) MarshalJSON ¶ added in v0.115.3
MarshalJSON is our marshaller for json data
func (*Template) Translations ¶ added in v0.115.3
func (t *Template) Translations() []assets.TemplateTranslation
Translations returns the translations for this template
func (*Template) UUID ¶ added in v0.115.3
func (t *Template) UUID() assets.TemplateUUID
UUID returns the UUID of this template
func (*Template) UnmarshalJSON ¶ added in v0.115.3
UnmarshalJSON is our unmarshaller for json data
type TemplateTranslation ¶ added in v0.115.3
type TemplateTranslation struct {
// contains filtered or unexported fields
}
TemplateTranslation represents a single template translation
func NewTemplateTranslation ¶ added in v0.115.3
func NewTemplateTranslation(channel assets.ChannelReference, language envs.Language, country envs.Country, content string, variableCount int, namespace string) *TemplateTranslation
NewTemplateTranslation creates a new template translation
func (*TemplateTranslation) Channel ¶ added in v0.115.3
func (t *TemplateTranslation) Channel() assets.ChannelReference
Channel returns the channel this template translation is for
func (*TemplateTranslation) Content ¶ added in v0.115.3
func (t *TemplateTranslation) Content() string
Content returns the translated content for this template
func (*TemplateTranslation) Country ¶ added in v0.115.3
func (t *TemplateTranslation) Country() envs.Country
Country returns the country this translation is for if any
func (*TemplateTranslation) Language ¶ added in v0.115.3
func (t *TemplateTranslation) Language() envs.Language
Language returns the language this translation is in
func (*TemplateTranslation) MarshalJSON ¶ added in v0.115.3
func (t *TemplateTranslation) MarshalJSON() ([]byte, error)
MarshalJSON is our marshaller for json data
func (*TemplateTranslation) Namespace ¶ added in v0.115.3
func (t *TemplateTranslation) Namespace() string
Namespace returns the namespace for this template
func (*TemplateTranslation) UnmarshalJSON ¶ added in v0.115.3
func (t *TemplateTranslation) UnmarshalJSON(data []byte) error
UnmarshalJSON is our unmarshaller for json data
func (*TemplateTranslation) VariableCount ¶ added in v0.115.3
func (t *TemplateTranslation) VariableCount() int
VariableCount returns the number of variables in this template
type Ticketer ¶ added in v0.115.3
type Ticketer struct { UUID_ assets.TicketerUUID `json:"uuid" validate:"required,uuid"` Name_ string `json:"name"` Type_ string `json:"type"` }
Ticketer is a JSON serializable implementation of a ticketer asset
func (*Ticketer) UUID ¶ added in v0.115.3
func (t *Ticketer) UUID() assets.TicketerUUID
UUID returns the UUID of this ticketer
type Topic ¶ added in v0.115.3
type Topic struct { UUID_ assets.TopicUUID `json:"uuid" validate:"required,uuid"` Name_ string `json:"name"` }
Topic is a JSON serializable implementation of a topic asset