github.com/decred/politeia@v1.4.0/politeiawww/cmd/cmswww/invoicecomments.go (about) 1 // Copyright (c) 2017-2019 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 "github.com/decred/politeia/politeiawww/cmd/shared" 8 9 // InvoiceCommentsCmd retreives the comments for the specified invoice. 10 type InvoiceCommentsCmd struct { 11 Args struct { 12 Token string `positional-arg-name:"token"` // Censorship token 13 } `positional-args:"true" required:"true"` 14 } 15 16 // Execute executes the invoice comments command. 17 func (cmd *InvoiceCommentsCmd) Execute(args []string) error { 18 gcr, err := client.InvoiceComments(cmd.Args.Token) 19 if err != nil { 20 return err 21 } 22 return shared.PrintJSON(gcr) 23 } 24 25 // invoiceCommentsHelpMsg is the output for the help command when 26 // 'invoicecomments' is specified. 27 const invoiceCommentsHelpMsg = `invoicecomments "token" 28 29 Get the comments for a invoice. 30 31 Arguments: 32 1. token (string, required) Invoice censorship token 33 34 Result: 35 { 36 "comments": [ 37 { 38 "token": (string) Censorship token 39 "parentid": (string) Id of comment (defaults to '0' (top-level)) 40 "comment": (string) Comment 41 "signature": (string) Signature of token+parentID+comment 42 "publickey": (string) Public key of user 43 "commentid": (string) Id of the comment 44 "receipt": (string) Server signature of the comment signature 45 "timestamp": (int64) Received UNIX timestamp 46 "resultvotes": (int64) Vote score 47 "upvotes": (uint64) Pro votes 48 "downvotes": (uint64) Contra votes 49 "censored": (bool) If comment has been censored 50 "userid": (string) User id 51 "username": (string) Username 52 } 53 ] 54 }`