media

package
v1.8.137 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2024 License: Zlib Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHD added in v1.8.43

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

GetHD 获取高清语音素材 可以使用本接口获取从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, domain string, 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, domain string, fileType string, 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

func UploadASync added in v1.8.43

func UploadASync(api *token.Api, domain string, file *BigFile) (string, error)

UploadASync 生成异步上传任务 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/media/upload_by_url?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 BigFile added in v1.8.43

type BigFile struct {
	Scene    int    `json:"scene"`
	Type     string `json:"type"`
	Filename string `json:"filename"`
	Url      string `json:"url"`
	Md5      string `json:"md5"`
}

type BigJob added in v1.8.43

type BigJob struct {
	Status int `json:"status"`
	Detail struct {
		Errcode   int    `json:"errcode"`
		Errmsg    string `json:"errmsg"`
		MediaId   string `json:"media_id"`
		CreatedAt string `json:"created_at"`
	} `json:"detail"`
}

func ASyncJob added in v1.8.43

func ASyncJob(api *token.Api, domain, jobId string) (BigJob, error)

ASyncJob 查询异步任务结果 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/media/get_upload_by_url_result?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 interface{} `json:"created_at,omitempty"` //企业微信为字符串,公众号为int64
}

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, domain, 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 UploadProvider added in v1.8.43

func UploadProvider(api *token.Api, fileType string, attachmentType int, img token.Form) (*ID, error)

UploadProvider 服务商上传临时素材 素材上传得到media_id,该media_id仅三天内有效 media_id在同一企业内应用之间可以共享 请求方式:POST(HTTPS) 请求地址:https://qyapi.weixin.qq.com/cgi-bin/service/media/upload?provider_access_token=ACCESS_TOKEN&type=TYPE&attachment_type=3 使用multipart/form-data POST上传文件, 文件标识名为"media"

func UploadV2 added in v1.8.39

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

func (*ID) Int64CreateAt added in v1.8.47

func (i *ID) Int64CreateAt() int64

func (*ID) StringCreateAt added in v1.8.47

func (i *ID) StringCreateAt() string

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