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 -8
View File
@@ -42,25 +42,19 @@ type inboxThing struct {
type inboxListing struct {
inboxThings
after string
before string
after string
}
func (l *inboxListing) After() string {
return l.after
}
func (l *inboxListing) Before() string {
return l.before
}
// UnmarshalJSON implements the json.Unmarshaler interface.
func (l *inboxListing) UnmarshalJSON(b []byte) error {
root := new(struct {
Data struct {
Things inboxThings `json:"children"`
After string `json:"after"`
Before string `json:"before"`
} `json:"data"`
})
@@ -71,7 +65,6 @@ func (l *inboxListing) UnmarshalJSON(b []byte) error {
l.inboxThings = root.Data.Things
l.after = root.Data.After
l.before = root.Data.Before
return nil
}