type_message

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgTypeText     = "text"
	MsgTypeImage    = "image"
	MsgTypeVoice    = "voice"
	MsgTypeVideo    = "video"
	MsgTypeLocation = "location"
	MsgTypeLink     = "link"
	MsgTypeEvent    = "event"
)
View Source
const (
	ReplyMsgTypeText  = "text"
	ReplyMsgTypeImage = "image"
	ReplyMsgTypeVoice = "voice"
	ReplyMsgTypeVideo = "video"
	ReplyMsgTypeMusic = "music"
	ReplyMsgTypeNews  = "news"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CDATA

type CDATA string

func (CDATA) MarshalXML

func (c CDATA) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type EncryptMessage

type EncryptMessage struct {
	XMLName    xml.Name `xml:"xml"`
	ToUserName string
	Encrypt    string
	AgentID    string
}

加密消息格式 <xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<AgentID><![CDATA[toAgentID]]></AgentID>
<Encrypt><![CDATA[msg_encrypt]]></Encrypt>

</xml>

type Message

type Message struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   string
	FromUserName string
	CreateTime   string
	MsgType      string
	MsgId        string
	AgentID      string
}

type MessageImage

type MessageImage struct {
	Message
	PicUrl  string
	MediaId string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[image]]></MsgType>
<PicUrl><![CDATA[this is a url]]></PicUrl>
<MediaId><![CDATA[media_id]]></MediaId>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageLink struct {
	Message
	Title       string
	Description string
	Url         string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1351776360</CreateTime>
<MsgType><![CDATA[link]]></MsgType>
<Title><![CDATA[公众平台官网链接]]></Title>
<Description><![CDATA[公众平台官网链接]]></Description>
<Url><![CDATA[url]]></Url>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageLocation

type MessageLocation struct {
	Message
	Location_X string
	Location_Y string
	Scale      string
	Label      string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1351776360</CreateTime>
<MsgType><![CDATA[location]]></MsgType>
<Location_X>23.134521</Location_X>
<Location_Y>113.358803</Location_Y>
<Scale>20</Scale>
<Label><![CDATA[位置信息]]></Label>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageText

type MessageText struct {
	Message
	Content string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[this is a test]]></Content>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageVideo

type MessageVideo struct {
	Message
	MediaId      string
	ThumbMediaId string
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[video]]></MsgType>
<MediaId><![CDATA[media_id]]></MediaId>
<ThumbMediaId><![CDATA[thumb_media_id]]></ThumbMediaId>
<MsgId>1234567890123456</MsgId>

</xml>

type MessageVoice

type MessageVoice struct {
	Message
	Format      string
	Recognition string
}

<xml>

<ToUserName>< ![CDATA[toUser] ]></ToUserName>
<FromUserName>< ![CDATA[fromUser] ]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType>< ![CDATA[voice] ]></MsgType>
<MediaId>< ![CDATA[media_id] ]></MediaId>
<Format>< ![CDATA[Format] ]></Format>
<Recognition>< ![CDATA[腾讯微信团队] ]></Recognition>
<MsgId>1234567890123456</MsgId>

</xml>

type ReplyEncryptMessage

type ReplyEncryptMessage struct {
	XMLName      xml.Name `xml:"xml"`
	Encrypt      string
	MsgSignature string
	TimeStamp    string
	Nonce        string
}

加密处理后 的 回复 消息体 <xml>

<Encrypt><![CDATA[msg_encrypt]]></Encrypt>
<MsgSignature><![CDATA[msg_signature]]></MsgSignature>
<TimeStamp>timestamp</TimeStamp>
<Nonce><![CDATA[nonce]]></Nonce>

</xml>

type ReplyMessage

type ReplyMessage struct {
	XMLName      xml.Name `xml:"xml"`
	ToUserName   CDATA
	FromUserName CDATA
	CreateTime   string
	MsgType      CDATA
}

type ReplyMessageImage

type ReplyMessageImage struct {
	ReplyMessage
	Image struct {
		MediaId CDATA
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[image]]></MsgType>
<Image>
    <MediaId><![CDATA[media_id]]></MediaId>
</Image>

</xml>

type ReplyMessageNews

type ReplyMessageNews struct {
	ReplyMessage
	ArticleCount string
	Articles     struct {
		Item []struct {
			Title       CDATA
			Description CDATA
			PicUrl      CDATA
			URL         CDATA
		}
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[news]]></MsgType>
<ArticleCount>1</ArticleCount>
<Articles>
  <item>
    <Title><![CDATA[title1]]></Title>
    <Description><![CDATA[description1]]></Description>
    <PicUrl><![CDATA[picurl]]></PicUrl>
    <Url><![CDATA[url]]></Url>
  </item>
</Articles>

</xml>

type ReplyMessageText

type ReplyMessageText struct {
	ReplyMessage
	Content CDATA
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1348831860</CreateTime>
<MsgType><![CDATA[text]]></MsgType>
<Content><![CDATA[this is a test]]></Content>

</xml>

type ReplyMessageVideo

type ReplyMessageVideo struct {
	ReplyMessage
	Video struct {
		MediaId     CDATA
		Title       CDATA
		Description CDATA
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>12345678</CreateTime>
<MsgType><![CDATA[video]]></MsgType>
<Video>
  <MediaId><![CDATA[media_id]]></MediaId>
  <Title><![CDATA[title]]></Title>
  <Description><![CDATA[description]]></Description>
</Video>

</xml>

type ReplyMessageVoice

type ReplyMessageVoice struct {
	ReplyMessage

	Voice struct {
		MediaId CDATA
	}
}

<xml>

<ToUserName><![CDATA[toUser]]></ToUserName>
<FromUserName><![CDATA[fromUser]]></FromUserName>
<CreateTime>1357290913</CreateTime>
<MsgType><![CDATA[voice]]></MsgType>
<Voice>
    <MediaId><![CDATA[media_id]]></MediaId>
</Voice>

</xml>

Jump to

Keyboard shortcuts

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