Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve comment for Personal Access Token in NewClient #103

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
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