Documentation
¶
Overview ¶
临时素材API.
Index ¶
- Constants
- type Article
- type Client
- func (clt *Client) CreateNews(articles []Article) (info *MediaInfo, err error)
- func (clt *Client) CreateVideo(mediaId, title, description string) (info *MediaInfo, err error)
- func (clt *Client) DownloadMedia(mediaId, filepath string) (written int64, err error)
- func (clt *Client) DownloadMediaToWriter(mediaId string, writer io.Writer) (written int64, err error)
- func (clt *Client) UploadImage(filepath string) (info *MediaInfo, err error)
- func (clt *Client) UploadImageFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
- func (clt *Client) UploadImagePermanent(imgPath string) (info ImageInfo, err error)
- func (clt *Client) UploadImagePermanentFromReader(filename string, reader io.Reader) (info ImageInfo, err error)
- func (clt *Client) UploadThumb(_filepath string) (info *MediaInfo, err error)
- func (clt *Client) UploadThumbFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
- func (clt *Client) UploadVideo(filepath string) (info *MediaInfo, err error)
- func (clt *Client) UploadVideoFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
- func (clt *Client) UploadVoice(filepath string) (info *MediaInfo, err error)
- func (clt *Client) UploadVoiceFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
- type ImageInfo
- type MediaInfo
Constants ¶
View Source
const ( MediaTypeImage = "image" MediaTypeVoice = "voice" MediaTypeVideo = "video" MediaTypeThumb = "thumb" MediaTypeNews = "news" )
View Source
const (
NewsArticleCountLimit = 10 // 图文素材里文章的个数限制
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { ThumbMediaId string `json:"thumb_media_id"` // 必须; 图文消息缩略图的 media_id, 可以在上传多媒体文件接口中获得 Title string `json:"title"` // 必须; 图文消息的标题 Author string `json:"author,omitempty"` // 可选; 图文消息的作者 Digest string `json:"digest,omitempty"` // 可选; 图文消息的摘要 Content string `json:"content"` // 必须; 图文消息页面的内容, 支持HTML标签 ContentSourceURL string `json:"content_source_url,omitempty"` // 可选; 在图文消息页面点击"阅读原文"后的页面 ShowCoverPic int `json:"show_cover_pic"` // 必须; 是否显示封面, 1为显示, 0为不显示 }
func (*Article) SetShowCoverPic ¶
type Client ¶
func (*Client) CreateNews ¶
创建图文消息素材.
func (*Client) DownloadMediaToWriter ¶
func (clt *Client) DownloadMediaToWriter(mediaId string, writer io.Writer) (written int64, err error)
下载多媒体到 io.Writer.
请注意, 视频文件不支持下载
func (*Client) UploadImage ¶
上传多媒体图片
func (*Client) UploadImageFromReader ¶
func (clt *Client) UploadImageFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
上传多媒体图片
NOTE: 参数 filename 不是文件路径, 是指定 multipart/form-data 里面文件名称
func (*Client) UploadImagePermanent ¶
上传图片到微信服务器, 给其他场景使用, 比如卡卷, POI.
func (*Client) UploadImagePermanentFromReader ¶
func (clt *Client) UploadImagePermanentFromReader(filename string, reader io.Reader) (info ImageInfo, err error)
上传图片到微信服务器, 给其他场景使用, 比如卡卷, POI.
func (*Client) UploadThumb ¶
上传多媒体缩略图
func (*Client) UploadThumbFromReader ¶
func (clt *Client) UploadThumbFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
上传多媒体缩略图
NOTE: 参数 filename 不是文件路径, 是指定 multipart/form-data 里面文件名称
func (*Client) UploadVideo ¶
上传多媒体视频
func (*Client) UploadVideoFromReader ¶
func (clt *Client) UploadVideoFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
上传多媒体视频
NOTE: 参数 filename 不是文件路径, 是指定 multipart/form-data 里面文件名称
func (*Client) UploadVoice ¶
上传多媒体语音
Click to show internal directories.
Click to hide internal directories.