From c5c634e477ff57962f80f168f474fb8f4e8e8e02 Mon Sep 17 00:00:00 2001 From: Andrey Beletsky Date: Fri, 20 Sep 2019 13:47:45 +0700 Subject: [PATCH] Pass user method url as a constant --- extras/lbryinc/client.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/extras/lbryinc/client.go b/extras/lbryinc/client.go index e6266c8..97abe1e 100644 --- a/extras/lbryinc/client.go +++ b/extras/lbryinc/client.go @@ -13,6 +13,15 @@ import ( log "github.com/sirupsen/logrus" ) +const ( + defaultServerAddress = "https://api.lbry.com" + timeout = 5 * time.Second + headerForwardedFor = "X-Forwarded-For" + + userObjectPath = "user" + userMeMethod = "me" +) + // Client stores data about internal-apis call it is about to make. type Client struct { AuthToken string @@ -39,13 +48,6 @@ type APIResponse struct { // ResponseData is a map containing parsed json response. type ResponseData map[string]interface{} -const ( - defaultServerAddress = "https://api.lbry.com" - timeout = 5 * time.Second - userObjectPath = "user" - headerForwardedFor = "X-Forwarded-For" -) - // NewClient returns a client instance for internal-apis. It requires authToken to be provided // for authentication. func NewClient(authToken string, opts *ClientOpts) Client { @@ -133,5 +135,5 @@ func (c Client) Call(object, method string, params map[string]interface{}) (Resp // UserMe returns user details for the user associated with the current auth_token func (c Client) UserMe() (ResponseData, error) { - return c.Call(userObjectPath, "me", map[string]interface{}{}) + return c.Call(userObjectPath, userMeMethod, map[string]interface{}{}) }