Files
email-api-client/client/client.go

40 lines
568 B
Go
Executable File

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
}