webhook

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

DingTalk WebHook Golang SDK (Unofficial)

Build Status go-report-card codecov codebeat badge

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionCard

type ActionCard struct {
	Text           string `json:"text"`
	Title          string `json:"title"`
	SingleTitle    string `json:"singleTitle"`
	SingleURL      string `json:"singleUrl"`
	BtnOrientation string `json:"btnOrientation"`
	HideAvatar     string `json:"hideAvatar"` //  robot message avatar
	Buttons        []struct {
		Title     string `json:"title"`
		ActionURL string `json:"actionUrl"`
	} `json:"btns"`
}

ActionCard `action card message struct`

type LinkMsg

type LinkMsg struct {
	Title      string `json:"title"`
	MessageURL string `json:"messageUrl"`
	PicURL     string `json:"picUrl"`
}

LinkMsg `link message struct`

type PayLoad

type PayLoad struct {
	MsgType string `json:"msgtype"`
	Text    struct {
		Content string `json:"content"`
	} `json:"text"`
	Link struct {
		Title      string `json:"title"`
		Text       string `json:"text"`
		PicURL     string `json:"picURL"`
		MessageURL string `json:"messageUrl"`
	} `json:"link"`
	Markdown struct {
		Title string `json:"title"`
		Text  string `json:"text"`
	} `json:"markdown"`
	ActionCard ActionCard `json:"actionCard"`
	FeedCard   struct {
		Links []LinkMsg `json:"links"`
	} `json:"feedCard"`
	At struct {
		AtMobiles []string `json:"atMobiles"`
		IsAtAll   bool     `json:"isAtAll"`
	} `json:"at"`
}

PayLoad payload

type Response

type Response struct {
	ErrorCode    int    `json:"errcode"`
	ErrorMessage string `json:"errmsg"`
}

Response `DingTalk web hook response struct`

type WebHook

type WebHook struct {
	AccessToken string `json:"accessToken"`
	APIURL      string `json:"apiUrl"`
}

WebHook `web hook base config`

func NewWebHook

func NewWebHook(accessToken string) *WebHook

NewWebHook `new a WebHook`

func (*WebHook) SendActionCardMsg

func (w *WebHook) SendActionCardMsg(title, content string, linkTitles, linkUrls []string, hideAvatar, btnOrientation bool) error

SendActionCardMsg `send single action card message`

func (*WebHook) SendLinkCardMsg

func (w *WebHook) SendLinkCardMsg(messages []LinkMsg) error

SendLinkCardMsg `send link card message`

func (*WebHook) SendLinkMsg

func (w *WebHook) SendLinkMsg(title, content, picURL, msgURL string) error

SendLinkMsg `send a link message`

func (*WebHook) SendMarkdownMsg

func (w *WebHook) SendMarkdownMsg(title, content string, isAtAll bool, mobiles ...string) error

SendMarkdownMsg `send a markdown msg`

func (*WebHook) SendTextMsg

func (w *WebHook) SendTextMsg(content string, isAtAll bool, mobiles ...string) error

SendTextMsg `send a text message`

Jump to

Keyboard shortcuts

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