massbyopenid

package
v0.0.0-...-f5adc6c Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2014 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

定义根据用户列表群发消息的消息数据结构

Index

Constants

View Source
const (
	MSG_TYPE_TEXT  = "text"
	MSG_TYPE_IMAGE = "image"
	MSG_TYPE_VOICE = "voice"
	MSG_TYPE_VIDEO = "video"
	MSG_TYPE_NEWS  = "mpnews"
)
View Source
const ToUserCountLimit = 10000

Variables

This section is empty.

Functions

This section is empty.

Types

type CommonHead

type CommonHead struct {
	ToUser  []string `json:"touser,omitempty"` // 长度不能超过 ToUserCountLimit
	MsgType string   `json:"msgtype"`
}

func (*CommonHead) CheckValid

func (head *CommonHead) CheckValid() (err error)

检查 CommonHead 是否有效,有效返回 nil,否则返回错误信息

type Image

type Image struct {
	CommonHead

	Image struct {
		MediaId string `json:"media_id"` // mediaId 通过上传多媒体文件得到
	} `json:"image"`
}

图片消息

func NewImage

func NewImage(toUser []string, mediaId string) *Image

图片消息

mediaId 通过上传多媒体文件得到

type News

type News struct {
	CommonHead

	News struct {
		MediaId string `json:"media_id"` // NOTE: MediaId 应该通过 Client.MediaCreateNews 得到
	} `json:"mpnews"`
}

图文消息

func NewNews

func NewNews(toUser []string, mediaId string) *News

新建图文消息

NOTE: MediaId 应该通过 Client.MediaCreateNews 得到

type Text

type Text struct {
	CommonHead

	Text struct {
		Content string `json:"content"`
	} `json:"text"`
}

文本消息

func NewText

func NewText(toUser []string, content string) *Text

新建文本消息

type Video

type Video struct {
	CommonHead

	Video struct {
		MediaId     string `json:"media_id"`              // NOTE: MediaId 应该通过 Client.MediaCreateVideo 得到
		Title       string `json:"title,omitempty"`       // 是否为多余???
		Description string `json:"description,omitempty"` // 是否为多余???
	} `json:"video"`
}

视频消息

func NewVideo

func NewVideo(toUser []string, mediaId, title, description string) *Video

新建视频消息

NOTE:
MediaId 应该通过 Client.MediaCreateVideo 得到
title, description 可以为空, 是否为多余???

type Voice

type Voice struct {
	CommonHead

	Voice struct {
		MediaId string `json:"media_id"` // mediaId 通过上传多媒体文件得到
	} `json:"voice"`
}

语音消息

func NewVoice

func NewVoice(toUser []string, mediaId string) *Voice

新建语音消息

mediaId 通过上传多媒体文件得到

Jump to

Keyboard shortcuts

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