Use string instead of slice for subreddits, edit comments

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-08-02 13:42:53 -04:00
parent bab7ff8e14
commit e74360e08d
5 changed files with 49 additions and 42 deletions
+3 -5
View File
@@ -55,7 +55,7 @@ type oauth2Config struct {
tokenURL string
// We need to set a custom user agent, because using the one set by default by the
// stdlib gives us 429 Too Many Request responses from the Reddit API
// stdlib gives us 429 Too Many Request responses from the Reddit API.
userAgentTransport *userAgentTransport
}
@@ -74,8 +74,6 @@ func oauth2Transport(c oauth2Config) *oauth2.Transport {
EndpointParams: params,
}
// We need to set a custom user agent, because using the one set by default by the
// stdlib gives us 429 Too Many Request responses from the Reddit API
httpClient := &http.Client{Transport: c.userAgentTransport}
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, httpClient)
@@ -87,8 +85,8 @@ func oauth2Transport(c oauth2Config) *oauth2.Transport {
return tr
}
// WithOAuth2 sets the necessary values for the client to authenticate via OAuth2
func WithOAuth2(id, secret, username, password string) Opt {
// WithCredentials sets the necessary values for the client to authenticate via OAuth2.
func WithCredentials(id, secret, username, password string) Opt {
return func(c *Client) error {
c.ID = id
c.Secret = secret