Rename package to go-reddit
Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
parent
f8d5a31b52
commit
4094044593
32 changed files with 53 additions and 53 deletions
2
Makefile
2
Makefile
|
@ -1,4 +1,4 @@
|
||||||
ROOT_PKG ?= "github.com/vartanbeno/geddit"
|
ROOT_PKG ?= "github.com/vartanbeno/go-reddit"
|
||||||
LIST_PKG := $(shell go list $(ROOT_PKG)/...)
|
LIST_PKG := $(shell go list $(ROOT_PKG)/...)
|
||||||
|
|
||||||
# Tests
|
# Tests
|
||||||
|
|
10
README.md
10
README.md
|
@ -1,17 +1,17 @@
|
||||||
# Geddit
|
# go-reddit
|
||||||
|
|
||||||
Geddit is a Go client library for accessing the Reddit API.
|
go-reddit is a Go client library for accessing the Reddit API.
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
To get a specific version from the list of [versions](https://github.com/vartanbeno/geddit/releases):
|
To get a specific version from the list of [versions](https://github.com/vartanbeno/go-reddit/releases):
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
go get github.com/vartanbeno/geddit@vX.Y.Z
|
go get github.com/vartanbeno/go-reddit@vX.Y.Z
|
||||||
```
|
```
|
||||||
|
|
||||||
Or for the latest version:
|
Or for the latest version:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
go get github.com/vartanbeno/geddit
|
go get github.com/vartanbeno/go-reddit
|
||||||
```
|
```
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
2
flair.go
2
flair.go
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
@ -17,7 +17,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
libraryName = "github.com/vartanbeno/geddit"
|
libraryName = "github.com/vartanbeno/go-reddit"
|
||||||
libraryVersion = "0.0.1"
|
libraryVersion = "0.0.1"
|
||||||
|
|
||||||
defaultBaseURL = "https://oauth.reddit.com"
|
defaultBaseURL = "https://oauth.reddit.com"
|
||||||
|
|
|
@ -31,7 +31,7 @@ to https://www.reddit.com/api/v1/access_token with the following form values:
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -11,24 +11,24 @@ type Opt func(*Client) error
|
||||||
// FromEnv configures the client with values from environment variables.
|
// FromEnv configures the client with values from environment variables.
|
||||||
//
|
//
|
||||||
// Supported environment variables:
|
// Supported environment variables:
|
||||||
// GEDDIT_CLIENT_ID to set the client's id.
|
// GO_REDDIT_CLIENT_ID to set the client's id.
|
||||||
// GEDDIT_CLIENT_SECRET to set the client's secret.
|
// GO_REDDIT_CLIENT_SECRET to set the client's secret.
|
||||||
// GEDDIT_CLIENT_USERNAME to set the client's username.
|
// GO_REDDIT_CLIENT_USERNAME to set the client's username.
|
||||||
// GEDDIT_CLIENT_PASSWORD to set the client's password.
|
// GO_REDDIT_CLIENT_PASSWORD to set the client's password.
|
||||||
func FromEnv(c *Client) error {
|
func FromEnv(c *Client) error {
|
||||||
if v, ok := os.LookupEnv("GEDDIT_CLIENT_ID"); ok {
|
if v, ok := os.LookupEnv("GO_REDDIT_CLIENT_ID"); ok {
|
||||||
c.ID = v
|
c.ID = v
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := os.LookupEnv("GEDDIT_CLIENT_SECRET"); ok {
|
if v, ok := os.LookupEnv("GO_REDDIT_CLIENT_SECRET"); ok {
|
||||||
c.Secret = v
|
c.Secret = v
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := os.LookupEnv("GEDDIT_CLIENT_USERNAME"); ok {
|
if v, ok := os.LookupEnv("GO_REDDIT_CLIENT_USERNAME"); ok {
|
||||||
c.Username = v
|
c.Username = v
|
||||||
}
|
}
|
||||||
|
|
||||||
if v, ok := os.LookupEnv("GEDDIT_CLIENT_PASSWORD"); ok {
|
if v, ok := os.LookupEnv("GO_REDDIT_CLIENT_PASSWORD"); ok {
|
||||||
c.Password = v
|
c.Password = v
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
@ -7,17 +7,17 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestFromEnv(t *testing.T) {
|
func TestFromEnv(t *testing.T) {
|
||||||
os.Setenv("GEDDIT_CLIENT_ID", "id1")
|
os.Setenv("GO_REDDIT_CLIENT_ID", "id1")
|
||||||
defer os.Unsetenv("GEDDIT_CLIENT_ID")
|
defer os.Unsetenv("GO_REDDIT_CLIENT_ID")
|
||||||
|
|
||||||
os.Setenv("GEDDIT_CLIENT_SECRET", "secret1")
|
os.Setenv("GO_REDDIT_CLIENT_SECRET", "secret1")
|
||||||
defer os.Unsetenv("GEDDIT_CLIENT_SECRET")
|
defer os.Unsetenv("GO_REDDIT_CLIENT_SECRET")
|
||||||
|
|
||||||
os.Setenv("GEDDIT_CLIENT_USERNAME", "username1")
|
os.Setenv("GO_REDDIT_CLIENT_USERNAME", "username1")
|
||||||
defer os.Unsetenv("GEDDIT_CLIENT_USERNAME")
|
defer os.Unsetenv("GO_REDDIT_CLIENT_USERNAME")
|
||||||
|
|
||||||
os.Setenv("GEDDIT_CLIENT_PASSWORD", "password1")
|
os.Setenv("GO_REDDIT_CLIENT_PASSWORD", "password1")
|
||||||
defer os.Unsetenv("GEDDIT_CLIENT_PASSWORD")
|
defer os.Unsetenv("GO_REDDIT_CLIENT_PASSWORD")
|
||||||
|
|
||||||
c, err := NewClient(nil, FromEnv)
|
c, err := NewClient(nil, FromEnv)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
2
go.mod
2
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module github.com/vartanbeno/geddit
|
module github.com/vartanbeno/go-reddit
|
||||||
|
|
||||||
go 1.14
|
go 1.14
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
2
multi.go
2
multi.go
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
2
post.go
2
post.go
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
2
user.go
2
user.go
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
2
util.go
2
util.go
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
2
vote.go
2
vote.go
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package geddit
|
package reddit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
Loading…
Reference in a new issue