media

package
v1.8.22 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: Zlib Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNews

func AddNews(api *token.Api, news *structs.Articles) (*structs.MediaId, error)

AddNews 新增永久图文素材 POST,https://api.weixin.qq.com/cgi-bin/material/add_news?access_token=ACCESS_TOKEN

func GetJSSDk

func GetJSSDk(api *token.Api, mediaId string) ([]byte, error)

GetJSSDk 获取高清语音素材 可以使用本接口获取从JSSDK的uploadVoice接口上传的临时语音素材,格式为speex,16K采样率。该音频比上文的临时素材获取接口(格式为amr,8K采样率)更加清晰,适合用作语音识别等对音质要求较高的业务。 请求方式:GET(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/media/get/jssdk?access_token=ACCESS_TOKEN&media_id=MEDIA_ID

func GetMaterial

func GetMaterial(api *token.Api, mediaId string) (*structs.ArticlesResult, error)

GetMaterial 获取永久素材 POST,https协议 https://api.weixin.qq.com/cgi-bin/material/get_material?access_token=ACCESS_TOKEN

func UpdateImage

func UpdateImage(api *token.Api, filename string) (string, error)

UpdateImage 上传图片 上传图片得到图片URL,该URL永久有效 返回的图片URL,仅能用于图文消息正文中的图片展示,或者给客户发送欢迎语等;若用于非企业微信环境下的页面,图片将被屏蔽。 每个企业每月最多可上传3000张图片,每天最多可上传1000张图片 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/media/uploadimg?access_token=ACCESS_TOKEN

func Upload

func Upload(api *token.Api, fileType, filename string) (*structs.MediaId, error)

Upload 上传临时素材 素材上传得到media_id,该media_id仅三天内有效 media_id在同一企业内应用之间可以共享 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE 使用multipart/form-data POST上传文件, 文件标识名为"media" fileType 分别有图片(image)、语音(voice)、视频(video),普通文件(file)

Types

type Id

type Id struct {
	MediaId string `json:"media_id"`
}

type Image

type Image struct {
	FileName string
}

func (*Image) CreateForm

func (u *Image) CreateForm(w *multipart.Writer, field string) error

Jump to

Keyboard shortcuts

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