medium

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: GPL-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MatrxGetAccessTokenURL     = "https://www.matrx.io/openapi/authserver/authToken/getToken"
	MatrxSendMessageToGroupURL = "https://www.matrx.io/openapi/sendmsgapi/send/toGroup"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type At

type At struct {
	AtMobiles []string `json:"atMobiles"`
	IsAtAll   bool     `json:"isAtAll"`
}

type AuthResponse added in v0.1.4

type AuthResponse struct {
	ResponseHeader struct {
		Status  int    `json:"status"`
		Msg     string `json:"msg"`
		Version string `json:"version"`
	} `json:"responseHeader"`

	Response struct {
		Token string `json:"token"`
	} `json:"response"`
}

type CommonResponse added in v0.1.4

type CommonResponse struct {
	ResponseHeader struct {
		Status int    `json:"status"`
		Msg    string `json:"msg"`
	} `json:"responseHeader"`
}

type DingRobot

type DingRobot struct {
	Token   string
	Secret  string
	ReqBody DingTalkMarkdown
}

medium struct

func NewDingRobot

func NewDingRobot() DingRobot

func (DingRobot) Send

func (robot DingRobot) Send() (err error)

type DingTalkMarkdown

type DingTalkMarkdown struct {
	MsgType  string    `json:"msgtype"`
	At       *At       `json:"at"`
	Markdown *Markdown `json:"markdown"`
}

request body struct

func NewDingTalkMarkdown

func NewDingTalkMarkdown() DingTalkMarkdown

func (*DingTalkMarkdown) SetAtMobiles

func (md *DingTalkMarkdown) SetAtMobiles(atMobiles []string)

func (*DingTalkMarkdown) SetIsAtAll

func (md *DingTalkMarkdown) SetIsAtAll(isAtAll bool)

func (*DingTalkMarkdown) SetText

func (md *DingTalkMarkdown) SetText(text string)

func (*DingTalkMarkdown) SetTitle

func (md *DingTalkMarkdown) SetTitle(title string)

type GroupText added in v0.1.4

type GroupText struct {
	Content string `json:"content"`
	Remind  string `json:"remind"`
	To      string `json:"to"`
}

type Markdown

type Markdown struct {
	Title string `json:"title"`
	Text  string `json:"text"`
}

type MatrxGroupText added in v0.1.4

type MatrxGroupText struct {
	MsgType string     `json:"msgtype"`
	Text    *GroupText `json:"text"`
}

request body struct

func NewMatrxText added in v0.1.4

func NewMatrxText() MatrxGroupText

func (*MatrxGroupText) SetContent added in v0.1.4

func (t *MatrxGroupText) SetContent(content string)

func (*MatrxGroupText) SetRemind added in v0.1.4

func (t *MatrxGroupText) SetRemind(remind string)

func (*MatrxGroupText) SetTo added in v0.1.4

func (t *MatrxGroupText) SetTo(to string)

type MatrxOpenapi added in v0.1.4

type MatrxOpenapi struct {
	ClientId     string
	ClientSecret string
	ReqBody      MatrxGroupText
}

medium struct

func NewMatrxOpenapi added in v0.1.4

func NewMatrxOpenapi() MatrxOpenapi

func (MatrxOpenapi) Send added in v0.1.4

func (api MatrxOpenapi) Send() (err error)

type Medium

type Medium interface {
	Send() (err error)
}

func CreateInterfaceMedium added in v0.1.0

func CreateInterfaceMedium(msgMedium string, msg message.Message) (med Medium, err error)

TODO: 使用抽象工厂模式改造 https://juejin.cn/post/7095581880200167432 根据 msgMedium 初始化媒体结构体

Jump to

Keyboard shortcuts

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