Remove "before" field from Response

Listing responses only ever contain a non-empty "before" field when the
"count" parameter is provided, which is only useful for the HTML
website, not really needed for API clients

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-09-29 14:19:32 -04:00
parent 15ee94fbbe
commit d128a7c4f7
6 changed files with 7 additions and 59 deletions
+1 -6
View File
@@ -127,7 +127,6 @@ type wikiPageRevisionListing struct {
Data struct {
Revisions []*WikiPageRevision `json:"children"`
After string `json:"after"`
Before string `json:"before"`
} `json:"data"`
}
@@ -135,10 +134,6 @@ func (l *wikiPageRevisionListing) After() string {
return l.Data.After
}
func (l *wikiPageRevisionListing) Before() string {
return l.Data.Before
}
// WikiPageRevision is a revision of a wiki page.
type WikiPageRevision struct {
ID string `json:"id,omitempty"`
@@ -329,7 +324,7 @@ func (s *WikiService) revisions(ctx context.Context, subreddit, page string, opt
}
if opts != nil {
idPrefix := "WikiRevision_"
const idPrefix = "WikiRevision_"
if opts.After != "" && !strings.HasPrefix(opts.After, idPrefix) {
opts.After = idPrefix + opts.After
}