Documentation
¶
Index ¶
- Constants
- Variables
- func ConvertMarkdownSlack(markdown string) string
- func ExampleMessageAttachmentURLValues() url.Values
- func WebhookInBodySlackToCc(slMsg Message) cc.Message
- type Attachment
- type ClientType
- type CommonPost
- type CreatePostRequest
- type Field
- type Message
- func ConvertCommonMessage(ccMsg cc.Message) Message
- func ExampleMessageAttachment() Message
- func ParseMessageAny(data []byte) (Message, error)
- func ParseMessageJSON(bytes []byte) (Message, error)
- func ParseMessageURLEncoded(data []byte) (Message, error)
- func ParseMessageURLValues(qry url.Values) (Message, error)
- type SlackAdapter
- func (adapter *SlackAdapter) SendMessage(message commonchat.Message, slackmsg any, opts map[string]any) (*fasthttp.Request, *fasthttp.Response, error)
- func (adapter *SlackAdapter) SendWebhook(urlOrUID string, ccMsg commonchat.Message, slackmsg any, opts map[string]any) (*fasthttp.Request, *fasthttp.Response, error)
- func (adapter *SlackAdapter) WebhookUID(ctx *fasthttp.RequestCtx) (string, error)
- type SlackWebhookClient
- func (client *SlackWebhookClient) BuildWebhookURL(urlOrUID string) string
- func (client *SlackWebhookClient) PostWebhookFast(url string, message Message) (*fasthttp.Request, *fasthttp.Response, error)
- func (client *SlackWebhookClient) PostWebhookGUIDFast(urlOrUID string, message Message) (*fasthttp.Request, *fasthttp.Response, error)
- type WebhookRequest
Constants ¶
View Source
const (
ParamNamePayload = "payload"
)
Variables ¶
View Source
var (
WebhookBaseURL = "https://hooks.slack.com/services/"
)
Functions ¶
func ConvertMarkdownSlack ¶
func ExampleMessageAttachmentURLValues ¶ added in v0.2.2
func WebhookInBodySlackToCc ¶
Types ¶
type Attachment ¶
type Attachment struct {
AuthorIcon string `json:"author_icon,omitempty"`
AuthorLink string `json:"author_link,omitempty"`
AuthorName string `json:"author_name,omitempty"`
Color string `json:"color,omitempty"`
Fallback string `json:"fallback,omitempty"`
Fields []Field `json:"fields,omitempty"`
MarkdownIn []string `json:"mrkdwn_in,omitempty"`
Pretext string `json:"pretext,omitempty"`
Text string `json:"text,omitempty"`
ThumbnailURL string `json:"thumbnail_url,omitempty"`
Title string `json:"title,omitempty"`
}
func ConvertAttachmentSlack ¶
func ConvertAttachmentSlack(commonAttachment cc.Attachment) Attachment
func ConvertAttachmentsSlack ¶
func ConvertAttachmentsSlack(commonAttachments []cc.Attachment) []Attachment
type CommonPost ¶
type CreatePostRequest ¶
type CreatePostRequest struct {
CommonPost
AsUser bool `json:"as_user,omitempty"`
IconURL string `json:"icon_url,omitempty"`
LinkNames bool `json:"link_names,omitempty"`
Parse bool `json:"parse,omitempty"`
ReplyBroadcast bool `json:"reply_broadcast,omitempty"`
UnfurlLinks bool `json:"unfurl_links,omitempty"`
UnfurlMedia bool `json:"unfurl_media,omitempty"`
ThreadTS float64 `json:"thread_ts,omitempty"`
}
type Field ¶
type Field struct {
Title string `json:"title,omitempty"`
Value jsonutil.String `json:"value,omitempty"`
Short bool `json:"short,omitempty"`
}
func ConvertFieldSlack ¶
func ConvertFieldsSlack ¶
type Message ¶
type Message struct {
Attachments []Attachment `json:"attachments,omitempty"`
IconEmoji string `json:"icon_emoji,omitempty"`
IconURL string `json:"icon_url,omitempty"`
Mrkdwn bool `json:"mrkdwn,omitempty"`
Text string `json:"text,omitempty"`
Username string `json:"username,omitempty"`
}
func ConvertCommonMessage ¶
func ExampleMessageAttachment ¶ added in v0.2.2
func ExampleMessageAttachment() Message
func ParseMessageAny ¶ added in v0.1.6
func ParseMessageJSON ¶ added in v0.1.5
func ParseMessageURLEncoded ¶ added in v0.1.6
type SlackAdapter ¶
type SlackAdapter struct {
SlackClient SlackWebhookClient
EmojiURLFormat string
WebhookURLOrUID string
}
func NewSlackAdapter ¶
func NewSlackAdapter(webhookURLOrUID string) (*SlackAdapter, error)
func (*SlackAdapter) SendMessage ¶
func (*SlackAdapter) SendWebhook ¶
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 ClientType) (SlackWebhookClient, error)
func (*SlackWebhookClient) BuildWebhookURL ¶
func (client *SlackWebhookClient) BuildWebhookURL(urlOrUID string) string
func (*SlackWebhookClient) PostWebhookFast ¶
func (*SlackWebhookClient) PostWebhookGUIDFast ¶
type WebhookRequest ¶
type WebhookRequest struct {
CommonPost
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.