adapters

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2017 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HTTPMethod = "POST"
)

Variables

View Source
var (
	AdaptersGlipActivityIncludeIntegrationName = false
	AdaptersGlipMarkdownQuote                  = false
	AdaptersGlipUseAttachments                 = false
	AdaptersGlipUseShortFields                 = false
	AdatpersGlipUseFieldExtraSpacing           = true
	EmojiURLFormat                             = ""
	WebhookURLOrUID                            = ""
)
View Source
var (
	ShowDisplayName = false
)
View Source
var (
	WebhookBaseURL = "https://hooks.slack.com/services/"
)

Functions

func IntegrationActivitySuffix

func IntegrationActivitySuffix(displayName string) string

Types

type Adapter

type Adapter interface {
	SendWebhook(url string, message cc.Message) (*fasthttp.Request, *fasthttp.Response, error)
	SendMessage(message cc.Message) (*fasthttp.Request, *fasthttp.Response, error)
	WebhookUID(ctx *fasthttp.RequestCtx) (string, error)
}

type GlipAdapter

type GlipAdapter struct {
	GlipClient      glipwebhook.GlipWebhookClient
	CommonConverter ccglip.GlipMessageConverter
	EmojiURLFormat  string
	WebhookURLOrUID string
}

func NewGlipAdapter

func NewGlipAdapter(webhookURLOrUID string) (GlipAdapter, error)

func (*GlipAdapter) SendMessage

func (adapter *GlipAdapter) SendMessage(message cc.Message) (*fasthttp.Request, *fasthttp.Response, error)

func (*GlipAdapter) SendWebhook

func (adapter *GlipAdapter) SendWebhook(urlOrUid string, message cc.Message) (*fasthttp.Request, *fasthttp.Response, error)

func (*GlipAdapter) WebhookUID

func (adapter *GlipAdapter) WebhookUID(ctx *fasthttp.RequestCtx) (string, error)

type SlackAdapter

type SlackAdapter struct {
	SlackClient     SlackWebhookClient
	EmojiURLFormat  string
	WebhookURLOrUID string
}

func NewSlackAdapter

func NewSlackAdapter(webhookURLOrUID string) (SlackAdapter, error)

func (*SlackAdapter) SendMessage

func (adapter *SlackAdapter) SendMessage(message commonchat.Message) (*fasthttp.Request, *fasthttp.Response, error)

func (*SlackAdapter) SendWebhook

func (adapter *SlackAdapter) SendWebhook(urlOrUid string, message commonchat.Message) (*fasthttp.Request, *fasthttp.Response, error)

func (*SlackAdapter) WebhookUID

func (adapter *SlackAdapter) WebhookUID(ctx *fasthttp.RequestCtx) (string, error)

type SlackWebhookClient

type SlackWebhookClient struct {
	HttpClient *http.Client
	FastClient fasthttp.Client
	WebhookUrl string
	UrlPrefix  *regexp.Regexp
}

func NewSlackWebhookClient

func NewSlackWebhookClient(urlOrUid string, clientType string) (SlackWebhookClient, error)

func (*SlackWebhookClient) BuildWebhookURL

func (client *SlackWebhookClient) BuildWebhookURL(urlOrUid string) string

func (*SlackWebhookClient) PostWebhookFast

func (client *SlackWebhookClient) PostWebhookFast(url string, message slack.Message) (*fasthttp.Request, *fasthttp.Response, error)

func (*SlackWebhookClient) PostWebhookGUIDFast

func (client *SlackWebhookClient) PostWebhookGUIDFast(urlOrUid string, message slack.Message) (*fasthttp.Request, *fasthttp.Response, error)

Jump to

Keyboard shortcuts

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