From 54417bf436fa293b4ac9016b11226a2297b7441d Mon Sep 17 00:00:00 2001 From: Steven Polley Date: Sat, 23 Mar 2024 19:45:28 -0600 Subject: [PATCH] don't export BearerToken --- ynab/client.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ynab/client.go b/ynab/client.go index b4a845b..ee98166 100644 --- a/ynab/client.go +++ b/ynab/client.go @@ -19,7 +19,7 @@ const apiBaseURL = "https://api.ynab.com/v1/budgets/" // endpoints. It holds the login credentials, http client/transport, // rate limit information, and the login session timer. type Client struct { - BearerToken string + bearerToken string BudgetID string httpClient *http.Client transport *http.Transport @@ -32,7 +32,7 @@ func (c *Client) get(endpoint string, out interface{}, query url.Values) error { if err != nil { return fmt.Errorf("failed to create new GET request: %v", err) } - req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.BearerToken)) + req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.bearerToken)) res, err := c.httpClient.Do(req) if err != nil { @@ -58,7 +58,7 @@ func (c *Client) post(endpoint string, out interface{}, body interface{}) error if err != nil { return fmt.Errorf("failed to create new POST request: %v", err) } - req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.BearerToken)) + req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.bearerToken)) req.Header.Add("Content-Type", "application/json") res, err := c.httpClient.Do(req) @@ -85,7 +85,7 @@ func (c *Client) put(endpoint string, out interface{}, body interface{}) error { if err != nil { return fmt.Errorf("failed to create new POST request: %v", err) } - req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.BearerToken)) + req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", c.bearerToken)) req.Header.Add("Content-Type", "application/json") res, err := c.httpClient.Do(req) @@ -140,7 +140,7 @@ func NewClient(budgetID, bearerToken string) (*Client, error) { // Create a new client c := &Client{ BudgetID: budgetID, - BearerToken: bearerToken, + bearerToken: bearerToken, httpClient: client, transport: transport, loc: loc,