operatorhipchat

package
v0.0.0-...-707806d Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2017 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultScopes = []string{"send_message", "send_notification", "view_group"}

Functions

func NewAddonHandler

func NewAddonHandler(store ClientCredentialsStore, config *AddonConfig) http.Handler

func NewRequestDecoder

func NewRequestDecoder(store ClientCredentialsStore) operator.Decoder

func NewSender

func NewSender(store ClientCredentialsStore, hostname string) operator.Sender

Types

type AddonConfig

type AddonConfig struct {
	Namespace         string
	URL               *url.URL
	Homepage          string
	WebhookURL        *url.URL
	WebhookPrefix     string
	APIConsumerScopes []string
}

type Client

type Client interface {
	GetUser(context.Context, int) (*User, error)
	SendRoomNotification(context.Context, *RoomNotification) error
}

func NewClient

func NewClient(ctx context.Context, config *ClientConfig) (Client, error)

type ClientConfig

type ClientConfig struct {
	Hostname    string
	Token       string
	Credentials *ClientCredentials
	Scopes      []string
}

func (*ClientConfig) Client

func (c *ClientConfig) Client(ctx context.Context) (Client, error)

func (*ClientConfig) ID

func (c *ClientConfig) ID() string

func (*ClientConfig) Secret

func (c *ClientConfig) Secret() string

type ClientCredentials

type ClientCredentials struct {
	ID     string
	Secret string
}

type ClientCredentialsStore

type ClientCredentialsStore interface {
	Create(*ClientCredentials) error
	GetByOAuthID(string) (Clienter, error)
}

func NewSQLStore

func NewSQLStore(db *sql.DB, hostname string) ClientCredentialsStore

type Clienter

type Clienter interface {
	ID() string
	Secret() string
	Client(context.Context) (Client, error)
}

type Item

type Item struct {
	Message *Message `json:"message"`
	Room    *Room    `json:"room"`
}

type Message

type Message struct {
	Message string `json:"message"`
	From    *User  `json:"from"`
}

type MessageOptions

type MessageOptions struct {
	Color string `json:"color"`
	From  string `json:"from"`
}

type Payload

type Payload struct {
	Event string `json:"event"`
	Item  *Item  `json:"item"`
}

type Room

type Room struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type RoomNotification

type RoomNotification struct {
	*MessageOptions
	Message       string `json:"message"`
	MessageFormat string `json:"message_format"`
	RoomID        int64  `json:"-"`
}

type User

type User struct {
	ID          int    `json:"id"`
	Name        string `json:"name"`
	Email       string `json:"email"`
	Deleted     bool   `json:"is_deleted"`
	MentionName string `json:"mention_name"`
}

Jump to

Keyboard shortcuts

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