Update PostStatus prototype
authorMikael Berthe <mikael@lilotux.net>
Wed, 05 Sep 2018 02:33:23 +0200
changeset 230 d13e9a780d91
parent 229 69f29aacd5bc
child 231 741291bb4772
Update PostStatus prototype
status.go
--- a/status.go	Wed Sep 05 02:33:23 2018 +0200
+++ b/status.go	Wed Sep 05 02:33:23 2018 +0200
@@ -14,6 +14,16 @@
 	"github.com/sendgrid/rest"
 )
 
+// PostStatusParams contains option fields for the PostStatus command
+type PostStatusParams struct {
+	Text        string
+	InReplyTo   int64
+	MediaIDs    []int64
+	Sensitive   bool
+	SpoilerText string
+	Visibility  string
+}
+
 // updateStatusOptions contains option fields for POST and DELETE API calls
 type updateStatusOptions struct {
 	// The ID is used for most commands
@@ -196,15 +206,15 @@
 // PostStatus posts a new "toot"
 // All parameters but "text" can be empty.
 // Visibility must be empty, or one of "direct", "private", "unlisted" and "public".
-func (mc *Client) PostStatus(text string, inReplyTo int64, mediaIDs []int64, sensitive bool, spoilerText string, visibility string) (*Status, error) {
+func (mc *Client) PostStatus(cmdParams PostStatusParams) (*Status, error) {
 	var status Status
 	o := updateStatusOptions{
-		Status:      text,
-		InReplyToID: inReplyTo,
-		MediaIDs:    mediaIDs,
-		Sensitive:   sensitive,
-		SpoilerText: spoilerText,
-		Visibility:  visibility,
+		Status:      cmdParams.Text,
+		InReplyToID: cmdParams.InReplyTo,
+		MediaIDs:    cmdParams.MediaIDs,
+		Sensitive:   cmdParams.Sensitive,
+		SpoilerText: cmdParams.SpoilerText,
+		Visibility:  cmdParams.Visibility,
 	}
 
 	err := mc.updateStatusData("status", o, &status)