go-micro: github.com/micro/go-micro/agent/input Index | Files | Directories

package input

import "github.com/micro/go-micro/agent/input"

Package input is an interface for bot inputs


Package Files



var (
    // Inputs keyed by name
    // Example slack or hipchat
    Inputs = map[string]Input{}

type Conn Uses

type Conn interface {
    Close() error
    Recv(*Event) error
    Send(*Event) error

Conn interface provides a way to send and receive events. Send and Recv both block until succeeding or failing.

type Event Uses

type Event struct {
    Type EventType
    From string
    To   string
    Data []byte
    Meta map[string]interface{}

Event is the unit sent and received

type EventType Uses

type EventType string
const (
    TextEvent EventType = "text"

type Input Uses

type Input interface {
    // Provide cli flags
    Flags() []cli.Flag
    // Initialise input using cli context
    Init(*cli.Context) error
    // Stream events from the input
    Stream() (Conn, error)
    // Start the input
    Start() error
    // Stop the input
    Stop() error
    // name of the input
    String() string

Input is an interface for sources which provide a way to communicate with the bot. Slack, HipChat, XMPP, etc.



Package input imports 1 packages (graph) and is imported by 16 packages. Updated 2020-01-30. Refresh now. Tools for package owners.