aboutsummaryrefslogtreecommitdiff
path: root/mastodon/status.go
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon/status.go')
-rw-r--r--mastodon/status.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/mastodon/status.go b/mastodon/status.go
index fd69914..b6110d5 100644
--- a/mastodon/status.go
+++ b/mastodon/status.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"io"
+ "mime/multipart"
"net/http"
"net/url"
"time"
@@ -295,3 +296,13 @@ func (c *Client) UploadMediaFromReader(ctx context.Context, reader io.Reader) (*
}
return &attachment, nil
}
+
+// UploadMediaFromReader uploads a media attachment from a io.Reader.
+func (c *Client) UploadMediaFromMultipartFileHeader(ctx context.Context, fh *multipart.FileHeader) (*Attachment, error) {
+ var attachment Attachment
+ err := c.doAPI(ctx, http.MethodPost, "/api/v1/media", fh, &attachment, nil)
+ if err != nil {
+ return nil, err
+ }
+ return &attachment, nil
+}