Skip to content

Commit

Permalink
Merge pull request #41 from whoiscarlo/patch-1
Browse files Browse the repository at this point in the history
added functions for setting ApiKey and Authorization Headers
  • Loading branch information
muratmirgun authored Dec 18, 2023
2 parents 8e8f9cc + 157b31e commit 17634ba
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var (
version = "v0.0.6"
version = "v0.1.0"
)

type Client struct {
Expand Down Expand Up @@ -81,10 +81,16 @@ func (c *Client) Ping() bool {
return true
}

// TokenAuth sets authorization headers for subsequent requests.
func (c *Client) TokenAuth(token string) *Client {
c.clientTransport.header.Set("Authorization", "Bearer "+token)
c.clientTransport.header.Set("apikey", token)
// SetApiKey sets api key header for subsequent requests.
func (c *Client) SetApiKey(apiKey string) *Client {
c.clientTransport.header.Set("apikey", apiKey)
return c
}


// SetAuthToken sets authorization header for subsequent requests.
func (c *Client) SetAuthToken(authToken string) *Client {
c.clientTransport.header.Set("Authorization", "Bearer "+authToken)
return c
}

Expand Down

0 comments on commit 17634ba

Please sign in to comment.