Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions intercom.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const (

type option func(c *Client) option

// Set Options on the Intercom Client, see TraceHTTP, BaseURI and SetHTTPClient.
// Option sets Options on the Intercom Client, see TraceHTTP, BaseURI and SetHTTPClient.
func (c *Client) Option(opts ...option) (previous option) {
for _, opt := range opts {
previous = opt(c)
Expand All @@ -60,14 +60,15 @@ func (c *Client) Option(opts ...option) (previous option) {
}

// NewClient returns a new Intercom API client, configured with the default HTTPClient.
// If you're using a Personal Access Token you can pass it where you would pass the appID and use an empty string for the apiKey
func NewClient(appID, apiKey string) *Client {
intercom := Client{AppID: appID, APIKey: apiKey, baseURI: defaultBaseURI, debug: false, clientVersion: clientVersion}
intercom.HTTPClient = interfaces.NewIntercomHTTPClient(intercom.AppID, intercom.APIKey, &intercom.baseURI, &intercom.clientVersion, &intercom.debug)
intercom.setup()
return &intercom
}

// Returns a new Intercom API client, configured with the supplied HTTPClient interface
// NewClientWithHTTPClient returns a new Intercom API client, configured with the supplied HTTPClient interface
func NewClientWithHTTPClient(appID, apiKey string, httpClient interfaces.HTTPClient) *Client {
intercom := Client{AppID: appID, APIKey: apiKey, baseURI: defaultBaseURI, debug: false, clientVersion: clientVersion, HTTPClient: httpClient}
intercom.setup()
Expand Down