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(TokenServer corp.TokenServer, HttpClient *http.Client) *Client
创建一个新的 Client.
如果 HttpClient == nil 则默认用 http.DefaultClient
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.