media

package
v1.8.39 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2023 License: Zlib Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 UpdateImage

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

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

func UpdateImageV2 added in v1.8.39

func UpdateImageV2(api *token.Api, img token.Form) (string, error)

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

Types

type Articles added in v1.8.38

type Articles struct {
	Articles []News `json:"articles"`
}

type ArticlesResult added in v1.8.38

type ArticlesResult struct {
	Items []NewsResult `json:"news_item"`
	FileName
}

func GetMaterial

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

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

type FileName added in v1.8.38

type FileName struct {
	Raw  []byte // 其他类型的素材消息,则响应的直接为素材的内容,开发者可以自行保存为文件
	File string
}

type ID added in v1.8.38

type ID struct {
	Type      string `json:"type,omitempty"`
	MediaId   string `json:"media_id"`
	CreatedAt int32  `json:"created_at,omitempty"`
}

func AddNews

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

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

func Upload

func Upload(api *token.Api, fileType, filename string) (*ID, 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)

func UploadV2 added in v1.8.39

func UploadV2(api *token.Api, fileType string, img token.Form) (*ID, error)

type Image

type Image struct {
	Field    string
	FileName string
}

func (*Image) CreateForm

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

type News added in v1.8.38

type News struct {
	Title              string `json:"title"`
	ThumbMediaId       string `json:"thumb_media_id"`
	Author             string `json:"author"`
	Digest             string `json:"digest"`
	ShowCoverPic       int8   `json:"show_cover_pic"`
	Content            string `json:"content"`
	ContentSourceUrl   string `json:"content_source_url"`
	NeedOpenComment    int8   `json:"need_open_comment"`
	OnlyFansCanComment int8   `json:"only_fans_can_comment"`
}

type NewsResult added in v1.8.38

type NewsResult struct {
	Title              string `json:"title"`
	ThumbMediaId       string `json:"thumb_media_id"`
	Author             string `json:"author"`
	Digest             string `json:"digest"`
	ShowCoverPic       int8   `json:"show_cover_pic"`
	Content            string `json:"content"`
	Url                string `json:"url"`
	Description        string `json:"description"`
	DownUrl            string `json:"down_url"`
	ContentSourceUrl   string `json:"content_source_url"`
	NeedOpenComment    int8   `json:"need_open_comment"`
	OnlyFansCanComment int8   `json:"only_fans_can_comment"`
}

Jump to

Keyboard shortcuts

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