Help us shape the future of Go! Take the 2026 Go Developer Survey

material

package
v2.1.14 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*context.Context
}

Client 素材管理接口实例

func NewClient

func NewClient(ctx *context.Context) *Client

NewClient 初始化实例

func (*Client) GetTempFile added in v2.1.8

func (r *Client) GetTempFile(mediaID string) ([]byte, error)

GetTempFile 获取临时素材 @see https://developer.work.weixin.qq.com/document/path/90254

func (*Client) UploadAttachment added in v2.1.6

func (r *Client) UploadAttachment(filename string, mediaType string, attachmentType int) (*UploadAttachmentResponse, error)

UploadAttachment 上传附件资源 @see https://developer.work.weixin.qq.com/document/path/95098 @mediaType 媒体文件类型,分别有图片(image)、视频(video)、普通文件(file) @attachment_type 附件类型,不同的附件类型用于不同的场景。1:朋友圈;2:商品图册

func (*Client) UploadAttachmentFromReader added in v2.1.7

func (r *Client) UploadAttachmentFromReader(filename, mediaType string, reader io.Reader, attachmentType int) (*UploadAttachmentResponse, error)

UploadAttachmentFromReader 上传附件资源 @see https://developer.work.weixin.qq.com/document/path/95098 @mediaType 媒体文件类型,分别有图片(image)、视频(video)、普通文件(file) @attachment_type 附件类型,不同的附件类型用于不同的场景。1:朋友圈;2:商品图册

func (*Client) UploadImg

func (r *Client) UploadImg(filename string) (*UploadImgResponse, error)

UploadImg 上传图片 @see https://developer.work.weixin.qq.com/document/path/90256

func (*Client) UploadImgFromReader added in v2.1.8

func (r *Client) UploadImgFromReader(filename string, reader io.Reader) (*UploadImgResponse, error)

UploadImgFromReader 从 io.Reader 上传图片 @see https://developer.work.weixin.qq.com/document/path/90256

func (*Client) UploadTempFile added in v2.1.5

func (r *Client) UploadTempFile(filename string, mediaType string) (*UploadTempFileResponse, error)

UploadTempFile 上传临时素材 @see https://developer.work.weixin.qq.com/document/path/90253 @mediaType 媒体文件类型,分别有图片(image)、语音(voice)、视频(video),普通文件(file)

func (*Client) UploadTempFileFromReader added in v2.1.7

func (r *Client) UploadTempFileFromReader(filename, mediaType string, reader io.Reader) (*UploadTempFileResponse, error)

UploadTempFileFromReader 上传临时素材 @see https://developer.work.weixin.qq.com/document/path/90253 @mediaType 媒体文件类型,分别有图片(image)、语音(voice)、视频(video),普通文件(file)

type UploadAttachmentResponse added in v2.1.6

type UploadAttachmentResponse struct {
	util.CommonError
	MediaID  string `json:"media_id"`
	CreateAt int64  `json:"created_at"`
	Type     string `json:"type"`
}

UploadAttachmentResponse 上传资源附件响应

type UploadImgResponse

type UploadImgResponse struct {
	util.CommonError
	URL string `json:"url"`
}

UploadImgResponse 上传图片响应

type UploadTempFileResponse added in v2.1.5

type UploadTempFileResponse struct {
	util.CommonError
	MediaID  string `json:"media_id"`
	CreateAt string `json:"created_at"`
	Type     string `json:"type"`
}

UploadTempFileResponse 上传临时素材响应

Jump to

Keyboard shortcuts

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