material

package
v0.0.0-...-10501a6 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

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"`
	Author           string `json:"author"`
	Digest           string `json:"digest"`
	ShowCoverPic     int    `json:"show_cover_pic"`
	Content          string `json:"content"`
	ContentSourceURL string `json:"content_source_url"`
}

Article 永久图文素材

type Material

type Material struct {
	*context.Context
}

Material 素材管理

func NewMaterial

func NewMaterial(context *context.Context) *Material

NewMaterial init

func (*Material) AddMaterial

func (material *Material) AddMaterial(mediaType MediaType, filename string) (mediaID string, url string, err error)

AddMaterial 上传永久性素材(处理视频需要单独上传)

func (*Material) AddNews

func (material *Material) AddNews(articles []*Article) (mediaID string, err error)

AddNews 新增永久图文素材

func (*Material) AddVideo

func (material *Material) AddVideo(filename, title, introduction string) (mediaID string, url string, err error)

AddVideo 永久视频素材文件上传

func (*Material) DeleteMaterial

func (material *Material) DeleteMaterial(mediaID string) error

DeleteMaterial 删除永久素材

func (*Material) GetMediaURL

func (material *Material) GetMediaURL(mediaID string) (mediaURL string, err error)

GetMediaURL 返回临时素材的下载地址供用户自己处理 NOTICE: URL 不可公开,因为含access_token 需要立即另存文件

func (*Material) ImageUpload

func (material *Material) ImageUpload(filename string) (url string, err error)

ImageUpload 图片上传

func (*Material) MediaUpload

func (material *Material) MediaUpload(mediaType MediaType, filename string) (media Media, err error)

MediaUpload 临时素材上传

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 媒体文件类型

Jump to

Keyboard shortcuts

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