github.com/decred/politeia@v1.4.0/politeiawww/cmd/cmswww/proposalbilling.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 (
     8  	v1 "github.com/decred/politeia/politeiawww/api/cms/v1"
     9  	"github.com/decred/politeia/politeiawww/cmd/shared"
    10  )
    11  
    12  // ProposalBillingCmd gets the invoices for the specified user.
    13  type ProposalBillingCmd struct {
    14  	Args struct {
    15  		Token string `positional-arg-name:"token"` // User ID
    16  	} `positional-args:"true" required:"true"`
    17  }
    18  
    19  // Execute executes the user invoices command.
    20  func (cmd *ProposalBillingCmd) Execute(args []string) error {
    21  	// Get user invoices
    22  	pbr, err := client.ProposalBilling(
    23  		&v1.ProposalBilling{
    24  			Token: cmd.Args.Token,
    25  		})
    26  	if err != nil {
    27  		return err
    28  	}
    29  
    30  	// Print user invoices
    31  	return shared.PrintJSON(pbr)
    32  }