-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
politeiawww: Add page sizes to policy replies.
The page sizes for various routes in the `records`, `comments`, and `ticketvote` APIs are hardcoded in the APIs as variables. This allows golang clients to references the variables. This commit adds the page sizes to the policy replies so that the gui can reference the policy response rather than hardcode the page sizes. This diff adds a new policy route to the records API to return the API's page sizes. In adittion, this adds a new pictl command `pictl recordpolicy` which calls the new route mentioned above.
- Loading branch information
Showing
12 changed files
with
121 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright (c) 2021 The Decred developers | ||
// Use of this source code is governed by an ISC | ||
// license that can be found in the LICENSE file. | ||
|
||
package main | ||
|
||
import ( | ||
pclient "github.com/decred/politeia/politeiawww/client" | ||
) | ||
|
||
// cmdRecordPolicy retrieves the records API policy. | ||
type cmdRecordPolicy struct{} | ||
|
||
// Execute executes the cmdRecordPolicy command. | ||
// | ||
// This function satisfies the go-flags Commander interface. | ||
func (c *cmdRecordPolicy) Execute(args []string) error { | ||
// Setup client | ||
opts := pclient.Opts{ | ||
HTTPSCert: cfg.HTTPSCert, | ||
Verbose: cfg.Verbose, | ||
RawJSON: cfg.RawJSON, | ||
} | ||
pc, err := pclient.New(cfg.Host, opts) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Get policy | ||
pr, err := pc.RecordPolicy() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// Print policy | ||
printJSON(pr) | ||
|
||
return nil | ||
} | ||
|
||
// recordPolicyHelpMsg is the printed to stdout by the help command. | ||
const recordPolicyHelpMsg = `recordpolicy | ||
Fetch the records API policy.` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters