transport

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2018 License: Apache-2.0 Imports: 4 Imported by: 7

README

Transport

Go Report Card GoDoc

Transport provides standard io access to a network transport layer.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNilTransport should be returned in places where a transport is required but is not set.
	ErrNilTransport = errors.New("transport cannot be nil")
	// ErrUserNotFound is returned if teh transport cannot locate a given user.
	ErrUserNotFound = errors.New("user not found")
)

Functions

This section is empty.

Types

type Channel

type Channel struct {
	*pb.BaseChannel
	Transport
}

Channel wraps a pb.BaseChannel up with it's accomanied transport.

type Config

type Config struct {
	Token       string
	IgnoreUsers []string
}

Config is a transport configuration.

type Event

type Event struct {
	*pb.BaseEvent
	Transport
}

Event wraps a pb.BaseEvent up with it's accompanied transport.

type Transport

type Transport interface {
	// TunnelEvents translates a specified network's events to Events tunneling them into evCh.
	// The session is terminated when ctx.Done returns.
	TunnelEvents(ctx context.Context, evCh chan *Event, errCh chan error)
	// SendMessage sends a message using the default format specified in the given transport.
	SendMessage(dest, msg string) error
	// SendEvent sends a new event over the given transport.
	SendEvent(ev *Event) error
	// Channels lists all the channels we have access to via this transport.
	Channels() ([]*Channel, error)
	// GetUser returns the full user data for the provided name or ID.
	GetUser(user string) (*User, error)
	// GetUsers returns a list of all known users.
	GetUsers() ([]*User, error)
	// GetConversation gets a private conversation for the given user ID.
	// This varies depending on network (may just be the user ID) but is required for Slack.
	GetConversation(userID string) (string, error)
}

Transport provides standard io access to a network transport layer.

type User

type User struct {
	*pb.BaseUser
	Transport
}

User wraps a pb.BaseUser up with it's accompanied transport.

Directories

Path Synopsis
internal
proto
Package pb is a generated protocol buffer package.
Package pb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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