github.com/decred/politeia@v1.4.0/politeiawww/cmd/cmswww/proposalbillingsummary.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 ProposalBillingSummaryCmd struct {
    14  	Args struct {
    15  	} `positional-args:"true" required:"true"`
    16  	Offset int `long:"offset" optional:"true"` // Offset length
    17  	Count  int `long:"count" optional:"true"`  // Page size
    18  }
    19  
    20  // Execute executes the user invoices command.
    21  func (cmd *ProposalBillingSummaryCmd) Execute(args []string) error {
    22  	// Get user invoices
    23  	pbsr, err := client.ProposalBillingSummary(
    24  		&v1.ProposalBillingSummary{
    25  			Offset: cmd.Offset,
    26  			Count:  cmd.Count,
    27  		})
    28  	if err != nil {
    29  		return err
    30  	}
    31  
    32  	// Print user invoices
    33  	return shared.PrintJSON(pbsr)
    34  }