github.com/decred/politeia@v1.4.0/politeiawww/cmd/cmswww/dcccomments.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 // DCCCommentsCmd retreives the comments for the specified dcc. 10 type DCCCommentsCmd 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 *DCCCommentsCmd) Execute(args []string) error { 18 gcr, err := client.DCCComments(cmd.Args.Token) 19 if err != nil { 20 return err 21 } 22 return shared.PrintJSON(gcr) 23 } 24 25 // dccCommentsHelpMsg is the output for the help command when 26 // 'dcccomments' is specified. 27 const dccCommentsHelpMsg = `dcccomments "token" 28 29 Get the comments for a invoice. 30 31 Arguments: 32 1. token (string, required) DCC 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 "censored": (bool) If comment has been censored 48 "userid": (string) User id 49 "username": (string) Username 50 } 51 ] 52 }`