github.com/decred/politeia@v1.4.0/politeiawww/cmd/cmswww/proposalowner.go (about) 1 // Copyright (c) 2017-2020 The Decred developers 2 // Use of this source code is governed by an ISC 3 // license that can be found in the LICENSE file. 4 5 package main 6 7 import ( 8 "fmt" 9 10 v1 "github.com/decred/politeia/politeiawww/api/cms/v1" 11 "github.com/decred/politeia/politeiawww/cmd/shared" 12 ) 13 14 // ProposalOwnerCmd retreives a list of users that have been filtered using the 15 // specified filtering params. 16 type ProposalOwnerCmd struct { 17 Args struct { 18 Token string `positional-arg-name:"token"` 19 } `positional-args:"true" optional:"true"` 20 } 21 22 // Execute executes the cmsusers command. 23 func (cmd *ProposalOwnerCmd) Execute(args []string) error { 24 token := cmd.Args.Token 25 if token == "" { 26 return fmt.Errorf("token is required") 27 } 28 u := v1.ProposalOwner{ 29 ProposalToken: cmd.Args.Token, 30 } 31 32 ur, err := client.ProposalOwner(&u) 33 if err != nil { 34 return err 35 } 36 return shared.PrintJSON(ur) 37 }