Skip to content

Commit c5c634e

Browse files
committed
Pass user method url as a constant
1 parent a8c339e commit c5c634e

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

extras/lbryinc/client.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@ import (
1313
log "github.com/sirupsen/logrus"
1414
)
1515

16+
const (
17+
defaultServerAddress = "https://api.lbry.com"
18+
timeout = 5 * time.Second
19+
headerForwardedFor = "X-Forwarded-For"
20+
21+
userObjectPath = "user"
22+
userMeMethod = "me"
23+
)
24+
1625
// Client stores data about internal-apis call it is about to make.
1726
type Client struct {
1827
AuthToken string
@@ -39,13 +48,6 @@ type APIResponse struct {
3948
// ResponseData is a map containing parsed json response.
4049
type ResponseData map[string]interface{}
4150

42-
const (
43-
defaultServerAddress = "https://api.lbry.com"
44-
timeout = 5 * time.Second
45-
userObjectPath = "user"
46-
headerForwardedFor = "X-Forwarded-For"
47-
)
48-
4951
// NewClient returns a client instance for internal-apis. It requires authToken to be provided
5052
// for authentication.
5153
func NewClient(authToken string, opts *ClientOpts) Client {
@@ -133,5 +135,5 @@ func (c Client) Call(object, method string, params map[string]interface{}) (Resp
133135

134136
// UserMe returns user details for the user associated with the current auth_token
135137
func (c Client) UserMe() (ResponseData, error) {
136-
return c.Call(userObjectPath, "me", map[string]interface{}{})
138+
return c.Call(userObjectPath, userMeMethod, map[string]interface{}{})
137139
}

0 commit comments

Comments
 (0)