From 49fdcfead5664717f11d60f83f7a31570898df96 Mon Sep 17 00:00:00 2001 From: Vartan Benohanian Date: Tue, 25 Aug 2020 20:55:32 -0400 Subject: [PATCH] Update readme Signed-off-by: Vartan Benohanian --- README.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 4cb949b..08c8f13 100644 --- a/README.md +++ b/README.md @@ -31,15 +31,18 @@ package main import "github.com/vartanbeno/go-reddit/reddit" func main() { - withCredentials := reddit.WithCredentials("id", "secret", "username", "password") - client, _ := reddit.NewClient(nil, withCredentials) + credentials := &reddit.Credentials{ + ID: "id", + Secret: "secret", + Username: "username", + Password: "password", + } + client, _ := reddit.NewClient(nil, credentials) } ``` The first argument (the one set to `nil`) is of type `*http.Client`. It will be used to make the requests. If nil, it will be set to `&http.Client{}`. -The `WithCredentials` option sets the credentials used to make requests to the Reddit API. - ## Examples
@@ -66,7 +69,7 @@ if err != nil { Get r/golang's top 5 posts of all time. ```go -result, _, err := client.Subreddit.Top(context.Background(), "golang", &reddit.ListPostOptions{ +result, _, err := client.Subreddit.TopPosts(context.Background(), "golang", &reddit.ListPostOptions{ ListOptions: reddit.ListOptions{ Limit: 5, },