Rename exportwatchingwallet zip option to download.

This commit is contained in:
Josh Rickmar 2014-01-22 10:08:09 -05:00
parent 8fb5c9f0e6
commit e321b6bdc7

16
cmds.go
View file

@ -108,7 +108,7 @@ func (cmd *GetCurrentNetCmd) UnmarshalJSON(b []byte) error {
type ExportWatchingWalletCmd struct { type ExportWatchingWalletCmd struct {
id interface{} id interface{}
Account string Account string
Zip bool Download bool
} }
// Enforce that ExportWatchingWalletCmd satisifies the btcjson.Cmd // Enforce that ExportWatchingWalletCmd satisifies the btcjson.Cmd
@ -123,7 +123,7 @@ func NewExportWatchingWalletCmd(id interface{}, optArgs ...interface{}) (*Export
// Optional parameters set to their defaults. // Optional parameters set to their defaults.
account := "" account := ""
zip := false dl := false
if len(optArgs) > 0 { if len(optArgs) > 0 {
a, ok := optArgs[0].(string) a, ok := optArgs[0].(string)
@ -133,17 +133,17 @@ func NewExportWatchingWalletCmd(id interface{}, optArgs ...interface{}) (*Export
account = a account = a
} }
if len(optArgs) > 1 { if len(optArgs) > 1 {
z, ok := optArgs[0].(bool) b, ok := optArgs[0].(bool)
if !ok { if !ok {
return nil, errors.New("second optarg zip must be a boolean") return nil, errors.New("second optarg zip must be a boolean")
} }
zip = z dl = b
} }
return &ExportWatchingWalletCmd{ return &ExportWatchingWalletCmd{
id: id, id: id,
Account: account, Account: account,
Zip: zip, Download: dl,
}, nil }, nil
} }
@ -178,11 +178,11 @@ func (cmd *ExportWatchingWalletCmd) MarshalJSON() ([]byte, error) {
Id: cmd.id, Id: cmd.id,
} }
if cmd.Account != "" || cmd.Zip { if cmd.Account != "" || cmd.Download {
raw.Params = append(raw.Params, cmd.Account) raw.Params = append(raw.Params, cmd.Account)
} }
if cmd.Zip { if cmd.Download {
raw.Params = append(raw.Params, cmd.Zip) raw.Params = append(raw.Params, cmd.Download)
} }
return json.Marshal(raw) return json.Marshal(raw)