adapter

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	RunAndAttach() (stdin chan Message, stdout chan Message, stderr chan error)
	ShouldRun(*plugin.Plugin, *Message) bool
}

func New

func New(adapterName string, environment map[string]string) (Adapter, error)

type HTTPAdapter

type HTTPAdapter struct {
	// contains filtered or unexported fields
}

func NewHTTP

func NewHTTP(port int) (*HTTPAdapter, error)

func (HTTPAdapter) RunAndAttach

func (ha HTTPAdapter) RunAndAttach() (chan Message, chan Message, chan error)

func (HTTPAdapter) ShouldRun

func (HTTPAdapter) ShouldRun(_ *plugin.Plugin, _ *Message) bool

type Message

type Message struct {
	// Emitter is the emitter of the message, in the case of Slack is clear, in
	// some other cases as for example the http adapter, it doesn't need to be set
	Emitter string
	// Receiver is the receiver of the message, for example: a channel ID
	Receiver string
	Body     string

	IsChannel       bool
	IsDirectMessage bool
}

type SlackAdapter

type SlackAdapter struct {
	// contains filtered or unexported fields
}

func NewSlack

func NewSlack(key string) (*SlackAdapter, error)

TODO: this requires refactoring, it's tooooo long

func (*SlackAdapter) RunAndAttach

func (sa *SlackAdapter) RunAndAttach() (chan Message, chan Message, chan error)

func (*SlackAdapter) ShouldRun

func (sa *SlackAdapter) ShouldRun(p *plugin.Plugin, m *Message) bool

type SlackMessage

type SlackMessage struct {
	Type    string `json:"type"`
	User    string `json:"user"`
	Channel string `json:"channel"`
	Text    string `json:"text"`
}

Jump to

Keyboard shortcuts

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