preview

package
v0.0.0-...-7011273 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2017 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

预览接口.

Index

Constants

View Source
const (
	MsgTypeText  = "text"
	MsgTypeImage = "image"
	MsgTypeVoice = "voice"
	MsgTypeVideo = "mpvideo"
	MsgTypeNews  = "mpnews"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*mp.WechatClient
}

func NewClient

func NewClient(AccessTokenServer mp.AccessTokenServer, httpClient *http.Client) Client

兼容保留, 建議實際項目全局維護一個 *mp.WechatClient

func (Client) SendImage

func (clt Client) SendImage(msg *Image) (msgid int64, err error)

func (Client) SendNews

func (clt Client) SendNews(msg *News) (msgid int64, err error)

func (Client) SendText

func (clt Client) SendText(msg *Text) (msgid int64, err error)

func (Client) SendVideo

func (clt Client) SendVideo(msg *Video) (msgid int64, err error)

func (Client) SendVoice

func (clt Client) SendVoice(msg *Voice) (msgid int64, err error)

type CommonMessageHeader

type CommonMessageHeader struct {
	ToUser  string `json:"touser"`
	MsgType string `json:"msgtype"`
}

type Image

type Image struct {
	CommonMessageHeader
	Image struct {
		MediaId string `json:"media_id"`
	} `json:"image"`
}

func NewImage

func NewImage(touser, mediaId string) *Image

type News

type News struct {
	CommonMessageHeader
	News struct {
		MediaId string `json:"media_id"`
	} `json:"mpnews"`
}

图文消息

func NewNews

func NewNews(touser, mediaId string) *News

新建图文消息

NOTE: mediaId 应该通过 media.Client.CreateNews 得到

type Text

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

func NewText

func NewText(touser, content string) *Text

type Video

type Video struct {
	CommonMessageHeader
	Video struct {
		MediaId string `json:"media_id"`
	} `json:"mpvideo"`
}

func NewVideo

func NewVideo(touser, mediaId string) *Video

新建视频消息

NOTE: mediaId 应该通过 media.Client.CreateVideo 得到

type Voice

type Voice struct {
	CommonMessageHeader
	Voice struct {
		MediaId string `json:"media_id"`
	} `json:"voice"`
}

func NewVoice

func NewVoice(touser, mediaId string) *Voice

Jump to

Keyboard shortcuts

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