cmd/accounts.go
changeset 220 08a2ee738117
parent 218 49d626ce0b01
child 222 e93d9c738273
--- 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")