channels

package
v0.8.6 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel interface {
	// ReceiveMessage from the channel
	ReceiveMessage(body []byte) (*messages.Receive, error)
	// ReceiveMessages from the channel. Starts a long running process, receives questions and sends them to the receiveChan
	ReceiveMessages(receiveChan chan messages.Receive)
	// SendMessage to the channel
	SendMessage(response *messages.Response) error
	// ValidateCallback validates a callback to the channel
	ValidateCallback(r *http.Request) bool
	// String returns the channel's name
	String() string
}

Channel interface implements a channel to send and receive messages on

type Channels

type Channels struct {
	Telegram Channel
	Twilio   Channel
	REST     Channel
	Slack    Channel
}

Channels combines all available channel clients

func New

func New(channelsConfig *Config) *Channels

New initializes all channels

type Config

type Config struct {
	Telegram telegram.Config `mapstructure:"telegram"`
	Twilio   twilio.Config   `mapstructure:"twilio"`
	Slack    slack.Config    `mapstructure:"slack"`
	REST     rest.Config     `mapstructure:"rest"`
}

Config struct combines all available client configurations

func LoadConfig

func LoadConfig(path string) (*Config, error)

LoadConfig loads channels configuration from chn.yml

Directories

Path Synopsis
Package mockchannels is a generated GoMock package.
Package mockchannels is a generated GoMock package.
mockslack
Package mockslack is a generated GoMock package.
Package mockslack is a generated GoMock package.
mocktelegram
Package mocktelegram is a generated GoMock package.
Package mocktelegram is a generated GoMock package.
mocktwilio
Package mocktwilio is a generated GoMock package.
Package mocktwilio is a generated GoMock package.

Jump to

Keyboard shortcuts

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