Documentation
¶
Index ¶
- 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) CountMaterial() (*MaterialCount, error)
- func (material *Material) DeleteMaterial(mediaID string) error
- func (material *Material) GetMaterial(id string) ([]byte, 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) ListMaterial(typ MediaType, offset, count int) (*MaterialList, error)
- func (material *Material) MediaUpload(mediaType MediaType, filename string) (media Media, err error)
- type MaterialCount
- type MaterialItem
- type MaterialList
- type Media
- type MediaType
Constants ¶
This section is empty.
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"`
NewsItem []*Article `json:"news_item"`
}
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) CountMaterial ¶ added in v1.3.0
func (material *Material) CountMaterial() (*MaterialCount, error)
CountMaterial 获取永久素材的总数
func (*Material) DeleteMaterial ¶
DeleteMaterial 删除永久素材
func (*Material) GetMaterial ¶ added in v1.3.0
GetMaterial 获取永久素材资源
func (*Material) GetMediaURL ¶
GetMediaURL 返回临时素材的下载地址供用户自己处理 NOTICE: URL 不可公开,因为含access_token 需要立即另存文件
func (*Material) ImageUpload ¶
ImageUpload 图片上传
func (*Material) ListMaterial ¶ added in v1.3.0
func (material *Material) ListMaterial(typ MediaType, offset, count int) (*MaterialList, error)
ListMaterial 获取永久素材的列表
type MaterialCount ¶ added in v1.3.0
type MaterialCount struct {
util.CommonError
VoiceCount int `json:"voice_count"`
VideoCount int `json:"video_count"`
ImageCount int `json:"image_count"`
NewsCount int `json:"news_count"`
}
MaterialCount 永久素材总数
type MaterialItem ¶ added in v1.3.0
type MaterialList ¶ added in v1.3.0
type MaterialList struct {
util.CommonError
TotalCount int `json:"total_count"`
ItemCount int `json:"item_count"`
Items []*MaterialItem `json:"item"`
}
type Media ¶
type Media struct {
util.CommonError
Type MediaType `json:"type"`
MediaID string `json:"media_id"`
ThumbMediaID string `json:"thumb_media_id"`
CreatedAt int64 `json:"created_at"`
}
Media 临时素材上传返回信息
type MediaType ¶
type MediaType string
MediaType 媒体文件类型
const ( //MediaTypeImage 媒体文件:图片 MediaTypeImage MediaType = "image" //MediaTypeVoice 媒体文件:声音 MediaTypeVoice MediaType = "voice" //MediaTypeVideo 媒体文件:视频 MediaTypeVideo MediaType = "video" //MediaTypeThumb 媒体文件:缩略图 MediaTypeThumb MediaType = "thumb" // MediaTypeNews 媒体文件:图文 MediaTypeNews MediaType = "news" )
Click to show internal directories.
Click to hide internal directories.