Remove sticky type
Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
parent
f649216b9d
commit
3bb31e2b43
2 changed files with 4 additions and 14 deletions
10
subreddit.go
10
subreddit.go
|
@ -127,12 +127,12 @@ func (s *SubredditServiceOp) GetModerated(ctx context.Context, opts *ListOptions
|
|||
|
||||
// GetSticky1 returns the first stickied post on a subreddit (if it exists).
|
||||
func (s *SubredditServiceOp) GetSticky1(ctx context.Context, name string) (*PostAndComments, *Response, error) {
|
||||
return s.getSticky(ctx, name, sticky1)
|
||||
return s.getSticky(ctx, name, 1)
|
||||
}
|
||||
|
||||
// GetSticky2 returns the second stickied post on a subreddit (if it exists).
|
||||
func (s *SubredditServiceOp) GetSticky2(ctx context.Context, name string) (*PostAndComments, *Response, error) {
|
||||
return s.getSticky(ctx, name, sticky2)
|
||||
return s.getSticky(ctx, name, 2)
|
||||
}
|
||||
|
||||
// Subscribe subscribes to subreddits based on their names.
|
||||
|
@ -249,11 +249,9 @@ func (s *SubredditServiceOp) getSubreddits(ctx context.Context, path string, opt
|
|||
|
||||
// getSticky returns one of the 2 stickied posts of the subreddit (if they exist).
|
||||
// Num should be equal to 1 or 2, depending on which one you want.
|
||||
// If it's <= 1, it's 1.
|
||||
// If it's >= 2, it's 2.
|
||||
func (s *SubredditServiceOp) getSticky(ctx context.Context, subreddit string, num sticky) (*PostAndComments, *Response, error) {
|
||||
func (s *SubredditServiceOp) getSticky(ctx context.Context, subreddit string, num int) (*PostAndComments, *Response, error) {
|
||||
type query struct {
|
||||
Num sticky `url:"num"`
|
||||
Num int `url:"num"`
|
||||
}
|
||||
|
||||
path := fmt.Sprintf("r/%s/about/sticky", subreddit)
|
||||
|
|
|
@ -82,14 +82,6 @@ func (t Timespan) String() string {
|
|||
return timespans[t]
|
||||
}
|
||||
|
||||
// todo: remove this, it is not needed
|
||||
type sticky int
|
||||
|
||||
const (
|
||||
sticky1 sticky = iota + 1
|
||||
sticky2
|
||||
)
|
||||
|
||||
type root struct {
|
||||
Kind string `json:"kind,omitempty"`
|
||||
Data interface{} `json:"data,omitempty"`
|
||||
|
|
Loading…
Reference in a new issue