Update README.md, remove one of the flair methods

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-08-06 19:26:47 -04:00
parent 11d1e2d5e0
commit b23b1b69f8
5 changed files with 26 additions and 99 deletions
+1 -27
View File
@@ -16,14 +16,6 @@ type FlairService struct {
// Flair is a flair on Reddit
type Flair struct {
ID string `json:"id,omitempty"`
Text string `json:"text,omitempty"`
Type string `json:"type,omitempty"`
CSS string `json:"css_class,omitempty"`
}
// FlairV2 is a flair on Reddit
type FlairV2 struct {
ID string `json:"id,omitempty"`
Text string `json:"text,omitempty"`
Type string `json:"type,omitempty"`
@@ -33,7 +25,7 @@ type FlairV2 struct {
// GetFromSubreddit returns the flairs from the subreddit
func (s *FlairService) GetFromSubreddit(ctx context.Context, name string) ([]Flair, *Response, error) {
path := fmt.Sprintf("r/%s/api/user_flair", name)
path := fmt.Sprintf("r/%s/api/user_flair_v2", name)
req, err := s.client.NewRequest(http.MethodGet, path, nil)
if err != nil {
@@ -48,21 +40,3 @@ func (s *FlairService) GetFromSubreddit(ctx context.Context, name string) ([]Fla
return flairs, resp, nil
}
// GetFromSubredditV2 returns the flairs from the subreddit
func (s *FlairService) GetFromSubredditV2(ctx context.Context, name string) ([]FlairV2, *Response, error) {
path := fmt.Sprintf("r/%s/api/user_flair_v2", name)
req, err := s.client.NewRequest(http.MethodGet, path, nil)
if err != nil {
return nil, nil, err
}
var flairs []FlairV2
resp, err := s.client.Do(ctx, req, &flairs)
if err != nil {
return nil, resp, err
}
return flairs, resp, nil
}