Revamp listing decoding, include after/before anchors in response
Now, instead of returning an object containing a list of results + the anchors, we return just the list. The anchors are available in the response object. Much cleaner this way in my opinion go-github and godo do it this way too. They include some meta information in the returned response objects Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
@@ -90,7 +90,7 @@ if err != nil {
|
||||
<summary>Get r/golang's top 5 posts of all time.</summary>
|
||||
|
||||
```go
|
||||
result, _, err := client.Subreddit.TopPosts(context.Background(), "golang", &reddit.ListPostOptions{
|
||||
posts, _, err := client.Subreddit.TopPosts(context.Background(), "golang", &reddit.ListPostOptions{
|
||||
ListOptions: reddit.ListOptions{
|
||||
Limit: 5,
|
||||
},
|
||||
@@ -99,7 +99,7 @@ result, _, err := client.Subreddit.TopPosts(context.Background(), "golang", &red
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Received %d posts.\n", len(result.Posts))
|
||||
fmt.Printf("Received %d posts.\n", len(posts))
|
||||
```
|
||||
</details>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user