Edit comments, change field type
Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
parent
5221f82daa
commit
730da4685d
5 changed files with 13 additions and 13 deletions
|
@ -92,6 +92,7 @@ func SortByActivity(opts url.Values) {
|
|||
|
||||
// SortByNumberOfComments sets the sort option to return the results with the highest
|
||||
// number of comments first.
|
||||
// This can be used when searching for posts within a subreddit.
|
||||
func SortByNumberOfComments(opts url.Values) {
|
||||
opts.Set("sort", "comments")
|
||||
}
|
||||
|
|
|
@ -142,17 +142,17 @@ func (s *SubredditService) GetDefault(ctx context.Context, opts *ListOptions) (*
|
|||
return s.getSubreddits(ctx, "subreddits/default", opts)
|
||||
}
|
||||
|
||||
// GetSubscribed returns the list of subreddits the client is subscribed to.
|
||||
// GetSubscribed returns the list of subreddits you are subscribed to.
|
||||
func (s *SubredditService) GetSubscribed(ctx context.Context, opts *ListOptions) (*Subreddits, *Response, error) {
|
||||
return s.getSubreddits(ctx, "subreddits/mine/subscriber", opts)
|
||||
}
|
||||
|
||||
// GetApproved returns the list of subreddits the client is an approved user in.
|
||||
// GetApproved returns the list of subreddits you are an approved user in.
|
||||
func (s *SubredditService) GetApproved(ctx context.Context, opts *ListOptions) (*Subreddits, *Response, error) {
|
||||
return s.getSubreddits(ctx, "subreddits/mine/contributor", opts)
|
||||
}
|
||||
|
||||
// GetModerated returns the list of subreddits the client is a moderator of.
|
||||
// GetModerated returns the list of subreddits you are a moderator of.
|
||||
func (s *SubredditService) GetModerated(ctx context.Context, opts *ListOptions) (*Subreddits, *Response, error) {
|
||||
return s.getSubreddits(ctx, "subreddits/mine/moderator", opts)
|
||||
}
|
||||
|
|
11
things.go
11
things.go
|
@ -160,15 +160,14 @@ type Comment struct {
|
|||
SubredditNamePrefixed string `json:"subreddit_name_prefixed,omitempty"`
|
||||
SubredditID string `json:"subreddit_id,omitempty"`
|
||||
|
||||
// Indicates if the client has upvote/downvoted (true/false)
|
||||
// If neither, it will be nil
|
||||
// Indicates if you've upvote/downvoted (true/false).
|
||||
// If neither, it will be nil.
|
||||
Likes *bool `json:"likes"`
|
||||
|
||||
Score int `json:"score"`
|
||||
Controversiality int `json:"controversiality"`
|
||||
|
||||
PostID string `json:"link_id,omitempty"`
|
||||
|
||||
// This doesn't appear when submitting a comment.
|
||||
PostTitle string `json:"link_title,omitempty"`
|
||||
// This doesn't appear when submitting a comment.
|
||||
|
@ -177,7 +176,7 @@ type Comment struct {
|
|||
PostAuthor string `json:"link_author,omitempty"`
|
||||
// This doesn't appear when submitting a comment
|
||||
// or when getting a post with its comments.
|
||||
PostNumComments int `json:"num_comments"`
|
||||
PostNumComments *int `json:"num_comments,omitempty"`
|
||||
|
||||
IsSubmitter bool `json:"is_submitter"`
|
||||
ScoreHidden bool `json:"score_hidden"`
|
||||
|
@ -251,8 +250,8 @@ type Post struct {
|
|||
Title string `json:"title,omitempty"`
|
||||
Body string `json:"selftext,omitempty"`
|
||||
|
||||
// Indicates if the client has upvote/downvoted (true/false)
|
||||
// If neither, it will be nil
|
||||
// Indicates if you've upvote/downvoted (true/false).
|
||||
// If neither, it will be nil.
|
||||
Likes *bool `json:"likes"`
|
||||
|
||||
Score int `json:"score"`
|
||||
|
|
6
user.go
6
user.go
|
@ -153,7 +153,7 @@ func (s *UserService) UsernameAvailable(ctx context.Context, username string) (b
|
|||
return *root, resp, nil
|
||||
}
|
||||
|
||||
// Overview returns a list of the client's posts and comments.
|
||||
// Overview returns a list of your posts and comments.
|
||||
func (s *UserService) Overview(ctx context.Context, opts ...SearchOptionSetter) (*Posts, *Comments, *Response, error) {
|
||||
return s.OverviewOf(ctx, s.client.Username, opts...)
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ func (s *UserService) OverviewOf(ctx context.Context, username string, opts ...S
|
|||
return root.getPosts(), root.getComments(), resp, nil
|
||||
}
|
||||
|
||||
// Posts returns a list of the client's posts.
|
||||
// Posts returns a list of your posts.
|
||||
func (s *UserService) Posts(ctx context.Context, opts ...SearchOptionSetter) (*Posts, *Response, error) {
|
||||
return s.PostsOf(ctx, s.client.Username, opts...)
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ func (s *UserService) PostsOf(ctx context.Context, username string, opts ...Sear
|
|||
return root.getPosts(), resp, nil
|
||||
}
|
||||
|
||||
// Comments returns a list of the client's comments.
|
||||
// Comments returns a list of your comments.
|
||||
func (s *UserService) Comments(ctx context.Context, opts ...SearchOptionSetter) (*Comments, *Response, error) {
|
||||
return s.CommentsOf(ctx, s.client.Username, opts...)
|
||||
}
|
||||
|
|
|
@ -100,7 +100,7 @@ var expectedComment = &Comment{
|
|||
PostTitle: "I'm giving away an iPhone 11 Pro to a commenter at random to celebrate Apollo for Reddit's new iOS 13 update and as a thank you to the community! Just leave a comment on this post and the winner will be selected randomly and announced tomorrow at 8 PM GMT. Details inside, and good luck!",
|
||||
PostPermalink: "https://www.reddit.com/r/apple/comments/d7ejpn/im_giving_away_an_iphone_11_pro_to_a_commenter_at/",
|
||||
PostAuthor: "iamthatis",
|
||||
PostNumComments: 89751,
|
||||
PostNumComments: Int(89751),
|
||||
}
|
||||
|
||||
var expectedRelationship = &Relationship{
|
||||
|
|
Loading…
Reference in a new issue