Remove duplicate code

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-09-13 22:20:00 -04:00
parent 7bb73ddc6e
commit f1b0d39a66
3 changed files with 32 additions and 247 deletions
+2 -15
View File
@@ -317,24 +317,11 @@ func (s *WikiService) UpdateSettings(ctx context.Context, subreddit, page string
// Discussions gets a list of discussions (posts) about the wiki page.
func (s *WikiService) Discussions(ctx context.Context, subreddit, page string, opts *ListOptions) ([]*Post, *Response, error) {
path := fmt.Sprintf("r/%s/wiki/discussions/%s", subreddit, page)
path, err := addOptions(path, opts)
if err != nil {
return nil, nil, err
}
req, err := s.client.NewRequest(http.MethodGet, path, nil)
if err != nil {
return nil, nil, err
}
root := new(thing)
resp, err := s.client.Do(ctx, req, root)
l, resp, err := s.client.getListing(ctx, path, opts)
if err != nil {
return nil, resp, err
}
listing, _ := root.Listing()
return listing.Posts(), resp, nil
return l.Posts(), resp, nil
}
// ToggleVisibility toggles the public visibility of a wiki page revision.