wecom

package
v0.0.0-...-98ad1ef Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMessage

func NewMessage(content Content) reporter.Message

func NewReporter

func NewReporter(endpoint string, opts ...Option) reporter.Reporter
Example
reporter := NewReporter("https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=18da439d-bda9-43cd-a76a-f3b04b730d60")
if err := reporter.Report(context.Background(), NewMessage(NewText("hello,world"))); err != nil {
	log.Fatalf("report the message error: %s", err)
}
Output:

Types

type Article

type Article struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	Url         string `json:"url"`
	PicUrl      string `json:"picurl"`
}

type Content

type Content interface {
	Type() string
	Body() interface{}
}

func NewFile

func NewFile(mediaId string) Content

func NewImage

func NewImage(b64, md5 string) Content

func NewImageFromBytes

func NewImageFromBytes(b []byte) Content

func NewMarkdown

func NewMarkdown(c string) Content

func NewNews

func NewNews(articles []*Article) Content

func NewText

func NewText(content string, opts ...TextOption) Content

type Option

type Option func(o *Options)

func Client

func Client(c *http.Client) Option

type Options

type Options struct {
	// contains filtered or unexported fields
}

type Response

type Response struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

func (*Response) Error

func (e *Response) Error() string

type TextOption

type TextOption func(t *text)

func MentionedList

func MentionedList(l ...string) TextOption

func MentionedMobileList

func MentionedMobileList(l ...string) TextOption

Jump to

Keyboard shortcuts

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