slack

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const EnvBotName = "SLACK_BOT_NAME"

EnvBotName is Slack bot name

View Source
const EnvChannelID = "SLACK_CHANNEL_ID"

EnvChannelID is Slack channel ID

View Source
const EnvToken = "SLACK_TOKEN"

EnvToken is Slack API Token

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	ChatPostMessage(ctx context.Context, attachments []*objects.Attachment) (*objects.ChatResponse, error)
}

API is Slack API interface

type Client

type Client struct {
	*slack.Client

	Config Config

	Notify *NotifyService

	API API
	// contains filtered or unexported fields
}

Client is a API client for Slack

func NewClient

func NewClient(cfg Config) (*Client, error)

NewClient returns Client initialized with Config

type Config

type Config struct {
	Token    string
	Channel  string
	Botname  string
	Title    string
	Message  string
	CI       string
	Parser   terraform.Parser
	Template terraform.Template
}

Config is a configuration for Slack client

type NotifyService

type NotifyService service

NotifyService handles communication with the notification related methods of Slack API

func (*NotifyService) Notify

func (s *NotifyService) Notify(body string) (exit int, err error)

Notify posts comment optimized for notifications

type Slack

type Slack struct {
	*slack.Client
	Channel string
	Botname string
}

Slack represents the attribute information necessary for requesting Slack API

func (*Slack) ChatPostMessage

func (s *Slack) ChatPostMessage(ctx context.Context, attachments []*objects.Attachment) (*objects.ChatResponse, error)

ChatPostMessage is a wrapper of https://godoc.org/github.com/lestrrat-go/slack#ChatPostMessageCall

Jump to

Keyboard shortcuts

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