github.com/decred/politeia@v1.4.0/politeiawww/cmd/pictl/cmdvotesubmissions.go (about) 1 // Copyright (c) 2020-2021 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 tkv1 "github.com/decred/politeia/politeiawww/api/ticketvote/v1" 9 pclient "github.com/decred/politeia/politeiawww/client" 10 ) 11 12 // cmdVoteSubmissions retrieves vote details for the provided record. 13 type cmdVoteSubmissions struct { 14 Args struct { 15 Token string `positional-arg-name:"token"` 16 } `positional-args:"true" required:"true"` 17 } 18 19 // Execute executes the cmdVoteSubmissions command. 20 // 21 // This function satisfies the go-flags Commander interface. 22 func (c *cmdVoteSubmissions) Execute(args []string) error { 23 // Setup client 24 opts := pclient.Opts{ 25 HTTPSCert: cfg.HTTPSCert, 26 Verbose: cfg.Verbose, 27 RawJSON: cfg.RawJSON, 28 } 29 pc, err := pclient.New(cfg.Host, opts) 30 if err != nil { 31 return err 32 } 33 34 // Get vote details 35 s := tkv1.Submissions{ 36 Token: c.Args.Token, 37 } 38 sr, err := pc.TicketVoteSubmissions(s) 39 if err != nil { 40 return err 41 } 42 43 // Print submissions 44 printJSON(sr) 45 46 return nil 47 } 48 49 // voteSubmissionsHelpMsg is printed to stdout by the help command. 50 const voteSubmissionsHelpMsg = `votesubmissions "token" 51 52 Get the list of submissions for a runoff vote. The token should be the token of 53 the runoff vote parent record. 54 55 Arguments: 56 1. token (string, required) Record token.`