Update calls to madon's PostStatus & UpdateAccount
This patch reflects prototype changes in the Madon library.
--- a/cmd/accounts.go Mon May 28 17:58:40 2018 +0000
+++ b/cmd/accounts.go Tue Sep 04 15:58:46 2018 +0200
@@ -623,36 +623,43 @@
report, err = gClient.ReportUser(opt.accountID, ids, opt.comment)
obj = report
case "update":
- var dn, note, avatar, header *string
- var locked *bool
+ var updateParams madon.UpdateAccountParams
change := false
+
if accountUpdateFlags.Lookup("display-name").Changed {
- dn = &opt.displayName
+ updateParams.DisplayName = &opt.displayName
change = true
}
if accountUpdateFlags.Lookup("note").Changed {
- note = &opt.note
+ updateParams.Note = &opt.note
change = true
}
if accountUpdateFlags.Lookup("avatar").Changed {
- avatar = &opt.avatar
+ updateParams.AvatarImagePath = &opt.avatar
change = true
}
if accountUpdateFlags.Lookup("header").Changed {
- header = &opt.header
+ updateParams.HeaderImagePath = &opt.header
change = true
}
if accountUpdateFlags.Lookup("locked").Changed {
- locked = &opt.locked
+ updateParams.Locked = &opt.locked
change = true
}
+ /*
+ TODO:
+ updateParams.Bot
+ updateParams.FieldsAttributes
+ updateParams.Source
+ */
+
if !change { // We want at least one update
return errors.New("missing parameters")
}
var account *madon.Account
- account, err = gClient.UpdateAccount(dn, note, avatar, header, locked)
+ account, err = gClient.UpdateAccount(updateParams)
obj = account
default:
return errors.New("accountSubcommand: internal error")
--- a/cmd/toot.go Mon May 28 17:58:40 2018 +0000
+++ b/cmd/toot.go Tue Sep 04 15:58:46 2018 +0200
@@ -147,7 +147,15 @@
}
}
- return gClient.PostStatus(tootText, opt.inReplyToID, ids, opt.sensitive, opt.spoiler, opt.visibility)
+ postParam := madon.PostStatusParams{
+ Text: tootText,
+ InReplyTo: opt.inReplyToID,
+ MediaIDs: ids,
+ Sensitive: opt.sensitive,
+ SpoilerText: opt.spoiler,
+ Visibility: opt.visibility,
+ }
+ return gClient.PostStatus(postParam)
}
func mentionsList(s *madon.Status) (string, error) {