We Had To Use Dark Magic To Make This Work

This commit is contained in:
2023-11-01 10:56:22 -04:00
commit 24a142c6a6
11 changed files with 416 additions and 0 deletions

39
client/client.go Executable file
View File

@@ -0,0 +1,39 @@
package client
type Client struct {
config *Configuration
token *Token
}
var c = struct {
client *Client
initialized bool
}{}
type accessTokenRequest struct {
GrantType string `json:"grant_type"`
ClientId string `json:"client_id"`
ClientSecret string `json:"client_secret"`
}
func NewClient(config *Configuration) *Client {
if c.initialized {
return c.client
}
client := &Client{
config: config,
}
token, err := getToken(client.config)
if err != nil {
return nil
}
client.token = token
c.client = client
return c.client
}