Add UploadMediaFromBytes function
This commit is contained in:
parent
309dce6ff3
commit
225db78d83
2 changed files with 18 additions and 1 deletions
|
@ -409,7 +409,12 @@ func (c *Client) UploadMedia(ctx context.Context, file string) (*Attachment, err
|
|||
return c.UploadMediaFromMedia(ctx, &Media{File: f})
|
||||
}
|
||||
|
||||
// UploadMediaFromReader uploads a media attachment from a io.Reader.
|
||||
// UploadMediaFromBytes uploads a media attachment from a byte slice.
|
||||
func (c *Client) UploadMediaFromBytes(ctx context.Context, b []byte) (*Attachment, error) {
|
||||
return c.UploadMediaFromReader(ctx, bytes.NewReader(b))
|
||||
}
|
||||
|
||||
// UploadMediaFromReader uploads a media attachment from an io.Reader.
|
||||
func (c *Client) UploadMediaFromReader(ctx context.Context, reader io.Reader) (*Attachment, error) {
|
||||
return c.UploadMediaFromMedia(ctx, &Media{File: reader})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue