media

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OfficialAccountMediaClient

type OfficialAccountMediaClient struct {
	*kernel.BaseClient

	AllowTypes []string
}

OfficialAccountMediaClient 是一个用于操作微信公众号素材的客户端。

func NewClient

NewClient 创建一个新的 OfficialAccountMediaClient 实例。

func (*OfficialAccountMediaClient) Get

func (client *OfficialAccountMediaClient) Get(ctx context.Context, mediaID string) (*http.Response, error)

## Get 获取临时素材

接口文档参考: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Get_temporary_materials.html

参数:

ctx    - 请求上下文
mediaID - 媒体ID

返回值:

*http.Response 包含素材的HTTP响应
error 调用过程中遇到的错误(如有)

func (*OfficialAccountMediaClient) GetJSSDK

func (client *OfficialAccountMediaClient) GetJSSDK(ctx context.Context, mediaID string) (*http.Response, error)

## Get 获取临时素材

接口文档参考: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/Get_temporary_materials.html

参数:

ctx    - 请求上下文
mediaID - 媒体ID

返回值:

*http.Response 包含素材的HTTP响应
error 调用过程中遇到的错误(如有)

func (*OfficialAccountMediaClient) Upload

func (client *OfficialAccountMediaClient) Upload(ctx context.Context, mediaType string, path string) (*schema.UploadMediaRes, error)

## Upload 上传临时素材

接口文档参考: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html

参数:

ctx      - 请求上下文
mediaType - 素材类型(image/voice/video/thumb)
path     - 文件路径

返回值:

*schema.UploadMediaRes 包含以下字段:
  • MediaID: 媒体ID
  • CreatedAt: 素材上传时间戳

error 调用过程中遇到的错误(如有)

func (*OfficialAccountMediaClient) UploadImage

func (client *OfficialAccountMediaClient) UploadImage(ctx context.Context, path string) (*schema.UploadMediaRes, error)

## UploadImage 上传临时图片素材

接口文档参考: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html

参数:

ctx  - 请求上下文
path - 图片文件路径

返回值:

*schema.UploadMediaRes 包含以下字段:
  • MediaID: 媒体ID
  • CreatedAt: 素材上传时间戳

error 调用过程中遇到的错误(如有)

func (*OfficialAccountMediaClient) UploadThumb

func (client *OfficialAccountMediaClient) UploadThumb(ctx context.Context, path string) (*schema.UploadMediaRes, error)

## UploadThumb 上传临时缩略图素材

接口文档参考: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html

参数:

ctx  - 请求上下文
path - 缩略图文件路径

返回值:

*schema.UploadMediaRes 包含以下字段:
  • MediaID: 媒体ID
  • CreatedAt: 素材上传时间戳

error 调用过程中遇到的错误(如有)

func (*OfficialAccountMediaClient) UploadVideo

func (client *OfficialAccountMediaClient) UploadVideo(ctx context.Context, path string) (*schema.UploadMediaRes, error)

## UploadVideo 上传临时视频素材

接口文档参考: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html

参数:

ctx  - 请求上下文
path - 视频文件路径

返回值:

*schema.UploadMediaRes 包含以下字段:
  • MediaID: 媒体ID
  • CreatedAt: 素材上传时间戳

error 调用过程中遇到的错误(如有)

func (*OfficialAccountMediaClient) UploadVoice

func (client *OfficialAccountMediaClient) UploadVoice(ctx context.Context, path string) (*schema.UploadMediaRes, error)

## UploadVoice 上传临时语音素材

接口文档参考: https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html

参数:

ctx  - 请求上下文
path - 语音文件路径

返回值:

*schema.UploadMediaRes 包含以下字段:
  • MediaID: 媒体ID
  • CreatedAt: 素材上传时间戳

error 调用过程中遇到的错误(如有)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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