Documentation ¶
Overview ¶
管理多媒体文件.
Index ¶
- Constants
- type Client
- func (clt Client) DownloadMedia(mediaId, filepath string) (err error)
- func (clt Client) DownloadMediaToWriter(mediaId string, writer io.Writer) error
- func (clt Client) UploadFile(filepath string) (info *MediaInfo, err error)
- func (clt Client) UploadFileFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
- func (clt Client) UploadImage(filepath string) (info *MediaInfo, err error)
- func (clt Client) UploadImageFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
- func (clt Client) UploadVideo(filepath string) (info *MediaInfo, err error)
- func (clt Client) UploadVideoFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
- func (clt Client) UploadVoice(filepath string) (info *MediaInfo, err error)
- func (clt Client) UploadVoiceFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
- type MediaInfo
Constants ¶
View Source
const ( MediaTypeImage = "image" MediaTypeVoice = "voice" MediaTypeVideo = "video" MediaTypeFile = "file" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
*corp.CorpClient
}
func NewClient ¶
func NewClient(AccessTokenServer corp.AccessTokenServer, httpClient *http.Client) Client
兼容保留, 建議實際項目全局維護一個 *corp.CorpClient
func (Client) DownloadMedia ¶
下载多媒体到文件.
func (Client) DownloadMediaToWriter ¶
下载多媒体到 io.Writer.
func (Client) UploadFile ¶
上传普通文件
func (Client) UploadFileFromReader ¶
func (clt Client) UploadFileFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
上传普通文件
NOTE: 参数 filename 不是文件路径, 是指定 multipart/form-data 里面文件名称
func (Client) UploadImage ¶
上传多媒体图片
func (Client) UploadImageFromReader ¶
func (clt Client) UploadImageFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
上传多媒体图片
NOTE: 参数 filename 不是文件路径, 是指定 multipart/form-data 里面文件名称
func (Client) UploadVideo ¶
上传多媒体视频
func (Client) UploadVideoFromReader ¶
func (clt Client) UploadVideoFromReader(filename string, reader io.Reader) (info *MediaInfo, err error)
上传多媒体视频
NOTE: 参数 filename 不是文件路径, 是指定 multipart/form-data 里面文件名称
func (Client) UploadVoice ¶
上传多媒体语音
Click to show internal directories.
Click to hide internal directories.