Get more replies to a comment via /api/morechildren

Also started using slices of pointers instead of slices of structs. This
is useful especially in the case of adding to the list of replies of a
comment. If the comment is a plain old struct (non-pointer), the change
wouldn't happen

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-07-19 22:03:37 -04:00
parent 0bfff72973
commit 5c376a1af4
8 changed files with 108 additions and 67 deletions
+2 -2
View File
@@ -15,7 +15,7 @@ import (
type ListingsService service
// Get returns posts, comments, and subreddits from their IDs.
func (s *ListingsService) Get(ctx context.Context, ids ...string) ([]Post, []Comment, []Subreddit, *Response, error) {
func (s *ListingsService) Get(ctx context.Context, ids ...string) ([]*Post, []*Comment, []*Subreddit, *Response, error) {
type query struct {
IDs []string `url:"id,comma"`
}
@@ -45,7 +45,7 @@ func (s *ListingsService) Get(ctx context.Context, ids ...string) ([]Post, []Com
}
// GetPosts returns posts from their full IDs.
func (s *ListingsService) GetPosts(ctx context.Context, ids ...string) ([]Post, *Response, error) {
func (s *ListingsService) GetPosts(ctx context.Context, ids ...string) ([]*Post, *Response, error) {
if len(ids) == 0 {
return nil, nil, errors.New("must provide at least 1 id")
}