Skip to content

Commit 8470cf4

Browse files
committed
feat(api): update via SDK Studio
1 parent dca56d2 commit 8470cf4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+89
-79
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ The full API of this library can be found in [api.md](api.md).
2323
import Intercom from 'intercom';
2424

2525
const intercom = new Intercom({
26-
apiKey: process.env['INTERCOM_API_KEY'], // This is the default and can be omitted
26+
accessToken: process.env['INTERCOM_ACCESS_TOKEN'], // This is the default and can be omitted
2727
environment: 'environment_1', // or 'production' | 'environment_2'; defaults to 'production'
2828
});
2929

@@ -45,7 +45,7 @@ This library includes TypeScript definitions for all request params and response
4545
import Intercom from 'intercom';
4646

4747
const intercom = new Intercom({
48-
apiKey: process.env['INTERCOM_API_KEY'], // This is the default and can be omitted
48+
accessToken: process.env['INTERCOM_ACCESS_TOKEN'], // This is the default and can be omitted
4949
environment: 'environment_1', // or 'production' | 'environment_2'; defaults to 'production'
5050
});
5151

src/index.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ type Environment = keyof typeof environments;
1616

1717
export interface ClientOptions {
1818
/**
19-
* Defaults to process.env['INTERCOM_API_KEY'].
19+
* Defaults to process.env['INTERCOM_ACCESS_TOKEN'].
2020
*/
21-
apiKey?: string | undefined;
21+
accessToken?: string | undefined;
2222

2323
/**
2424
* Specifies the environment to use for the API.
@@ -89,14 +89,14 @@ export interface ClientOptions {
8989

9090
/** API Client for interfacing with the Intercom API. */
9191
export class Intercom extends Core.APIClient {
92-
apiKey: string;
92+
accessToken: string;
9393

9494
private _options: ClientOptions;
9595

9696
/**
9797
* API Client for interfacing with the Intercom API.
9898
*
99-
* @param {string | undefined} [opts.apiKey=process.env['INTERCOM_API_KEY'] ?? undefined]
99+
* @param {string | undefined} [opts.accessToken=process.env['INTERCOM_ACCESS_TOKEN'] ?? undefined]
100100
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
101101
* @param {string} [opts.baseURL=process.env['INTERCOM_BASE_URL'] ?? https://api.intercom.io] - Override the default base URL for the API.
102102
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
@@ -108,17 +108,17 @@ export class Intercom extends Core.APIClient {
108108
*/
109109
constructor({
110110
baseURL = Core.readEnv('INTERCOM_BASE_URL'),
111-
apiKey = Core.readEnv('INTERCOM_API_KEY'),
111+
accessToken = Core.readEnv('INTERCOM_ACCESS_TOKEN'),
112112
...opts
113113
}: ClientOptions = {}) {
114-
if (apiKey === undefined) {
114+
if (accessToken === undefined) {
115115
throw new Errors.IntercomError(
116-
"The INTERCOM_API_KEY environment variable is missing or empty; either provide it, or instantiate the Intercom client with an apiKey option, like new Intercom({ apiKey: 'My API Key' }).",
116+
"The INTERCOM_ACCESS_TOKEN environment variable is missing or empty; either provide it, or instantiate the Intercom client with an accessToken option, like new Intercom({ accessToken: 'My Access Token' }).",
117117
);
118118
}
119119

120120
const options: ClientOptions = {
121-
apiKey,
121+
accessToken,
122122
...opts,
123123
baseURL,
124124
environment: opts.environment ?? 'production',
@@ -139,7 +139,7 @@ export class Intercom extends Core.APIClient {
139139
});
140140
this._options = options;
141141

142-
this.apiKey = apiKey;
142+
this.accessToken = accessToken;
143143
}
144144

145145
me: API.Me = new API.Me(this);
@@ -178,7 +178,7 @@ export class Intercom extends Core.APIClient {
178178
}
179179

180180
protected override authHeaders(opts: Core.FinalRequestOptions): Core.Headers {
181-
return { Authorization: `Bearer ${this.apiKey}` };
181+
return { Authorization: `Bearer ${this.accessToken}` };
182182
}
183183

184184
protected override stringifyQuery(query: Record<string, unknown>): string {

tests/api-resources/admins/activity-logs.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Intercom from 'intercom';
44
import { Response } from 'node-fetch';
55

66
const intercom = new Intercom({
7-
apiKey: 'My API Key',
7+
accessToken: 'My Access Token',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

tests/api-resources/admins/admins.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Intercom from 'intercom';
44
import { Response } from 'node-fetch';
55

66
const intercom = new Intercom({
7-
apiKey: 'My API Key',
7+
accessToken: 'My Access Token',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

tests/api-resources/articles.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Intercom from 'intercom';
44
import { Response } from 'node-fetch';
55

66
const intercom = new Intercom({
7-
apiKey: 'My API Key',
7+
accessToken: 'My Access Token',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

tests/api-resources/companies/companies.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Intercom from 'intercom';
44
import { Response } from 'node-fetch';
55

66
const intercom = new Intercom({
7-
apiKey: 'My API Key',
7+
accessToken: 'My Access Token',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

tests/api-resources/companies/contacts.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Intercom from 'intercom';
44
import { Response } from 'node-fetch';
55

66
const intercom = new Intercom({
7-
apiKey: 'My API Key',
7+
accessToken: 'My Access Token',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

tests/api-resources/companies/segments.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Intercom from 'intercom';
44
import { Response } from 'node-fetch';
55

66
const intercom = new Intercom({
7-
apiKey: 'My API Key',
7+
accessToken: 'My Access Token',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

tests/api-resources/contacts/companies.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Intercom from 'intercom';
44
import { Response } from 'node-fetch';
55

66
const intercom = new Intercom({
7-
apiKey: 'My API Key',
7+
accessToken: 'My Access Token',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

tests/api-resources/contacts/contacts.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Intercom from 'intercom';
44
import { Response } from 'node-fetch';
55

66
const intercom = new Intercom({
7-
apiKey: 'My API Key',
7+
accessToken: 'My Access Token',
88
baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
99
});
1010

0 commit comments

Comments
 (0)