Documentation ¶
Index ¶
- type Article
- type ArticleList
- type ArticleListContent
- type ArticleListItem
- 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) BatchGetMaterial(permanentMaterialType PermanentMaterialType, offset, count int64) (list ArticleList, err error)
- func (material *Material) DeleteMaterial(mediaID string) error
- func (material *Material) GetMaterialCount() (res ResMaterialCount, err 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) UpdateNews(article *Article, mediaID string, index int64) (err error)
- type Media
- type MediaType
- type PermanentMaterialType
- type ResMaterialCount
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"` }
Article 永久图文素材
type ArticleList ¶
type ArticleList struct { util.CommonError TotalCount int64 `json:"total_count"` ItemCount int64 `json:"item_count"` Item []ArticleListItem `json:"item"` }
ArticleList 永久素材列表
type ArticleListContent ¶
type ArticleListContent struct { NewsItem []Article `json:"news_item"` UpdateTime int64 `json:"update_time"` CreateTime int64 `json:"create_time"` }
ArticleListContent 用于ArticleListItem的content节点
type ArticleListItem ¶
type ArticleListItem struct { MediaID string `json:"media_id"` Content ArticleListContent `json:"content"` Name string `json:"name"` URL string `json:"url"` UpdateTime int64 `json:"update_time"` }
ArticleListItem 用于ArticleList的item节点
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) BatchGetMaterial ¶
func (material *Material) BatchGetMaterial(permanentMaterialType PermanentMaterialType, offset, count int64) (list ArticleList, err error)
BatchGetMaterial 批量获取永久素材
func (*Material) DeleteMaterial ¶
DeleteMaterial 删除永久素材
func (*Material) GetMaterialCount ¶
func (material *Material) GetMaterialCount() (res ResMaterialCount, err error)
GetMaterialCount 获取素材总数.
func (*Material) GetMediaURL ¶
GetMediaURL 返回临时素材的下载地址供用户自己处理 NOTICE: URL 不可公开,因为含access_token 需要立即另存文件
func (*Material) ImageUpload ¶
ImageUpload 图片上传
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 PermanentMaterialType ¶
type PermanentMaterialType string
PermanentMaterialType 永久素材类型
const ( // PermanentMaterialTypeImage 永久素材图片类型(image) PermanentMaterialTypeImage PermanentMaterialType = "image" // PermanentMaterialTypeVideo 永久素材视频类型(video) PermanentMaterialTypeVideo PermanentMaterialType = "video" // PermanentMaterialTypeVoice 永久素材语音类型 (voice) PermanentMaterialTypeVoice PermanentMaterialType = "voice" // PermanentMaterialTypeNews 永久素材图文类型(news) PermanentMaterialTypeNews PermanentMaterialType = "news" )
type ResMaterialCount ¶
type ResMaterialCount struct { util.CommonError VoiceCount int64 `json:"voice_count"` // 语音总数量 VideoCount int64 `json:"video_count"` // 视频总数量 ImageCount int64 `json:"image_count"` // 图片总数量 NewsCount int64 `json:"news_count"` // 图文总数量 }
ResMaterialCount 素材总数
Click to show internal directories.
Click to hide internal directories.