Documentation ¶
Index ¶
- Constants
- type Article
- type Material
- func (material *Material) AddMaterial(mediaType MediaType, filename string) (mediaID string, url string, err error)
- func (material *Material) AddNews(articles []*Article) (mediaID string, err error)
- func (material *Material) AddVideo(filename, title, introduction string) (mediaID string, url string, err error)
- func (material *Material) DeleteMaterial(mediaID string) error
- func (material *Material) GetMediaURL(mediaID string) (mediaURL string, err error)
- func (material *Material) GetNews(id string) ([]*Article, error)
- func (material *Material) ImageUpload(filename string) (url string, err error)
- func (material *Material) MediaUpload(mediaType MediaType, filename string) (media Media, err error)
- func (material *Material) MediaUploadData(mediaType MediaType, filedata []byte, filename string) (media Media, err error)
- func (material *Material) MediaUploadForMultipart(mediaType MediaType, f multipart.File, header *multipart.FileHeader) (media Media, err error)
- type Media
- type MediaType
Constants ¶
View Source
const ( //MediaTypeImage 媒体文件:图片 MediaTypeImage MediaType = "image" //MediaTypeVoice 媒体文件:声音 MediaTypeVoice = "voice" //MediaTypeVideo 媒体文件:视频 MediaTypeVideo = "video" //MediaTypeThumb 媒体文件:缩略图 MediaTypeThumb = "thumb" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { Title string `json:"title"` ThumbMediaID string `json:"thumb_media_id"` ThumbURL string `json:"thumb_url"` Author string `json:"author"` Digest string `json:"digest"` ShowCoverPic int `json:"show_cover_pic"` Content string `json:"content"` ContentSourceURL string `json:"content_source_url"` URL string `json:"url"` DownURL string `json:"down_url"` }
Article 永久图文素材
type Material ¶
Material 素材管理
func (*Material) AddMaterial ¶
func (material *Material) AddMaterial(mediaType MediaType, filename string) (mediaID string, url string, err error)
AddMaterial 上传永久性素材(处理视频需要单独上传)
func (*Material) AddVideo ¶
func (material *Material) AddVideo(filename, title, introduction string) (mediaID string, url string, err error)
AddVideo 永久视频素材文件上传
func (*Material) DeleteMaterial ¶
DeleteMaterial 删除永久素材
func (*Material) GetMediaURL ¶
GetMediaURL 返回临时素材的下载地址供用户自己处理 NOTICE: URL 不可公开,因为含access_token 需要立即另存文件
func (*Material) ImageUpload ¶
ImageUpload 图片上传
func (*Material) MediaUpload ¶
func (material *Material) MediaUpload(mediaType MediaType, filename string) (media Media, err error)
MediaUpload 临时素材上传
func (*Material) MediaUploadData ¶
func (material *Material) MediaUploadData(mediaType MediaType, filedata []byte, filename string) (media Media, err error)
MediaUpload 临时素材上传 但是调用PostMultipartForm 传入 []byte 上传成功 filename: aa.png
func (*Material) MediaUploadForMultipart ¶
func (material *Material) MediaUploadForMultipart(mediaType MediaType, f multipart.File, header *multipart.FileHeader) (media Media, err error)
MediaUpload 临时素材上传 数据来源于 post 上传的文件
Click to show internal directories.
Click to hide internal directories.