add UploadMedia
This commit is contained in:
parent
959459eb42
commit
af67397430
3 changed files with 82 additions and 5 deletions
10
status.go
10
status.go
|
@ -201,3 +201,13 @@ func (c *Client) Search(ctx context.Context, q string, resolve bool) (*Results,
|
|||
}
|
||||
return &results, nil
|
||||
}
|
||||
|
||||
// PostMedia upload a media attachment.
|
||||
func (c *Client) UploadMedia(ctx context.Context, file string) (*Attachment, error) {
|
||||
var attachment Attachment
|
||||
err := c.doAPI(ctx, http.MethodPost, "/api/v1/media", file, &attachment)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &attachment, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue