From 20ec335b01985f71d6fc43d29aec7fe5c20ac73e Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Thu, 20 Mar 2025 12:33:32 +0000 Subject: [PATCH] SDK regeneration --- README.md | 42 ++-- jest.config.js => jest.config.mjs | 5 +- package.json | 32 +-- reference.md | 64 +++--- scripts/rename-to-esm-files.js | 115 ++++++++++ src/Client.ts | 6 +- src/api/resources/admins/client/Client.ts | 67 +++--- src/api/resources/articles/client/Client.ts | 84 ++++--- src/api/resources/companies/client/Client.ts | 155 +++++++------ src/api/resources/contacts/client/Client.ts | 208 ++++++++++-------- .../resources/conversations/client/Client.ts | 177 ++++++++------- .../resources/dataAttributes/client/Client.ts | 49 +++-- src/api/resources/dataExport/client/Client.ts | 63 +++--- src/api/resources/events/client/Client.ts | 47 ++-- .../resources/helpCenters/client/Client.ts | 38 ++-- .../resources/collections/client/Client.ts | 78 ++++--- src/api/resources/messages/client/Client.ts | 21 +- src/api/resources/news/client/Client.ts | 35 +-- .../news/resources/feeds/client/Client.ts | 47 ++-- .../news/resources/items/client/Client.ts | 73 +++--- src/api/resources/notes/client/Client.ts | 50 +++-- .../phoneCallRedirects/client/Client.ts | 21 +- src/api/resources/segments/client/Client.ts | 35 +-- .../subscriptionTypes/client/Client.ts | 19 +- src/api/resources/tags/client/Client.ts | 133 ++++++----- src/api/resources/teams/client/Client.ts | 31 ++- .../resources/ticketTypes/client/Client.ts | 59 +++-- .../resources/attributes/client/Client.ts | 37 ++-- src/api/resources/tickets/client/Client.ts | 70 +++--- src/api/resources/visitors/client/Client.ts | 47 ++-- src/core/fetcher/Fetcher.ts | 13 +- src/core/fetcher/createRequestUrl.ts | 2 +- src/core/fetcher/getRequestBody.ts | 4 +- src/core/fetcher/makeRequest.ts | 2 +- src/core/fetcher/requestWithRetries.ts | 4 +- src/core/fetcher/signals.ts | 2 +- .../Node18UniversalStreamWrapper.ts | 5 +- .../stream-wrappers/NodePre18StreamWrapper.ts | 1 + .../stream-wrappers/UndiciStreamWrapper.ts | 4 +- .../stream-wrappers/chooseStreamWrapper.ts | 3 +- src/core/json.ts | 27 +++ src/core/runtime/runtime.ts | 111 +++++----- src/errors/IntercomError.ts | 4 +- src/version.ts | 2 +- tests/unit/auth/BasicAuth.test.ts | 2 +- tests/unit/fetcher/Fetcher.test.ts | 7 +- tests/unit/fetcher/createRequestUrl.test.ts | 4 +- tests/unit/fetcher/makeRequest.test.ts | 5 +- tests/unit/fetcher/requestWithRetries.test.ts | 13 +- .../Node18UniversalStreamWrapper.test.ts | 2 +- .../NodePre18StreamWrapper.test.ts | 2 +- .../UndiciStreamWrapper.test.ts | 2 +- .../chooseStreamWrapper.test.ts | 2 +- .../fetcher/stream-wrappers/webpack.test.ts | 10 +- tsconfig.json | 4 +- yarn.lock | 165 +++++++++----- 56 files changed, 1384 insertions(+), 926 deletions(-) rename jest.config.js => jest.config.mjs (55%) create mode 100644 scripts/rename-to-esm-files.js create mode 100644 src/core/json.ts diff --git a/README.md b/README.md index b55707b6..a2e2c58a 100644 --- a/README.md +++ b/README.md @@ -105,14 +105,14 @@ const response = await client.articles.create(..., { ### Retries The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long -as the request is deemed retriable and the number of retry attempts has not grown larger than the configured +as the request is deemed retryable and the number of retry attempts has not grown larger than the configured retry limit (default: 2). -A request is deemed retriable when any of the following HTTP status codes is returned: +A request is deemed retryable when any of the following HTTP status codes is returned: -- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) -- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) -- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) +- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout) +- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests) +- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors) Use the `maxRetries` request option to configure this behavior. @@ -149,12 +149,12 @@ controller.abort(); // aborts the request The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following runtimes: -- Node.js 18+ -- Vercel -- Cloudflare Workers -- Deno v1.25+ -- Bun 1.0+ -- React Native +- Node.js 18+ +- Vercel +- Cloudflare Workers +- Deno v1.25+ +- Bun 1.0+ +- React Native ### Customizing Fetch Client @@ -170,6 +170,16 @@ const client = new IntercomClient({ }); ``` +## Contributing + +While we value open-source contributions to this SDK, this library is generated programmatically. +Additions made directly to this library would have to be moved over to our generation code, +otherwise they would be overwritten upon the next generated release. Feel free to open a PR as +a proof of concept, but know that we will not be able to merge it as-is. We suggest opening +an issue first to discuss with us! + +On the other hand, contributions to the README are always very welcome! + ## Request Options This client library also supports passing in [`request` options](https://github.com/axios/axios#request-config): @@ -191,13 +201,3 @@ client.useRequestOpts({ baseURL: "https://api.eu.intercom.io", }); ``` - -## Contributing - -While we value open-source contributions to this SDK, this library is generated programmatically. -Additions made directly to this library would have to be moved over to our generation code, -otherwise they would be overwritten upon the next generated release. Feel free to open a PR as -a proof of concept, but know that we will not be able to merge it as-is. We suggest opening -an issue first to discuss with us! - -On the other hand, contributions to the README are always very welcome! diff --git a/jest.config.js b/jest.config.mjs similarity index 55% rename from jest.config.js rename to jest.config.mjs index 35d6e65b..c7248211 100644 --- a/jest.config.js +++ b/jest.config.mjs @@ -1,5 +1,8 @@ /** @type {import('jest').Config} */ -module.exports = { +export default { preset: "ts-jest", testEnvironment: "node", + moduleNameMapper: { + "(.+)\.js$": "$1", + }, }; diff --git a/package.json b/package.json index 0a5a6102..8679953d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "intercom-client", - "version": "v6.1.1", + "version": "6.2.0", "private": false, "repository": "https://github.com/intercom/intercom-node", "main": "./index.js", @@ -15,25 +15,25 @@ "url-join": "4.0.1", "form-data": "^4.0.0", "formdata-node": "^6.0.3", - "node-fetch": "2.7.0", - "qs": "6.11.2", + "node-fetch": "^2.7.0", + "qs": "^6.13.1", "readable-stream": "^4.5.2", - "js-base64": "3.7.2" + "js-base64": "3.7.7" }, "devDependencies": { "@types/url-join": "4.0.1", - "@types/qs": "6.9.8", - "@types/node-fetch": "2.6.9", - "@types/readable-stream": "^4.0.15", - "webpack": "^5.94.0", - "ts-loader": "^9.3.1", - "jest": "29.7.0", - "@types/jest": "29.5.5", - "ts-jest": "29.1.1", - "jest-environment-jsdom": "29.7.0", - "@types/node": "17.0.33", - "prettier": "2.7.1", - "typescript": "4.6.4" + "@types/qs": "^6.9.17", + "@types/node-fetch": "^2.6.12", + "@types/readable-stream": "^4.0.18", + "webpack": "^5.97.1", + "ts-loader": "^9.5.1", + "jest": "^29.7.0", + "@types/jest": "^29.5.14", + "ts-jest": "^29.1.1", + "jest-environment-jsdom": "^29.7.0", + "@types/node": "^18.19.70", + "prettier": "^3.4.2", + "typescript": "~5.7.2" }, "browser": { "fs": false, diff --git a/reference.md b/reference.md index 65fd0e3b..fd0ceaf4 100644 --- a/reference.md +++ b/reference.md @@ -1457,9 +1457,9 @@ while (page.hasNextPage()) { The `list all companies` functionality does not work well for huge datasets, and can result in errors and performance problems when paging deeply. The Scroll API provides an efficient mechanism for iterating over all companies in a dataset. -- Each app can only have 1 scroll open at a time. You'll get an error message if you try to have more than one open per app. -- If the scroll isn't used for 1 minute, it expires and calls with that scroll param will fail -- If the end of the scroll is reached, "companies" will be empty and the scroll parameter will expire +- Each app can only have 1 scroll open at a time. You'll get an error message if you try to have more than one open per app. +- If the scroll isn't used for 1 minute, it expires and calls with that scroll param will fail +- If the end of the scroll is reached, "companies" will be empty and the scroll parameter will expire {% admonition type="info" name="Scroll Parameter" %} You can get the first page of companies by simply sending a GET request to the scroll endpoint. @@ -2376,8 +2376,8 @@ If a contact has recently been created, there is a possibility that it will not You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). There are some limitations to the amount of multiple's there can be: -- There's a limit of max 2 nested filters -- There's a limit of max 15 filters for each AND or OR group +- There's a limit of max 2 nested filters +- There's a limit of max 15 filters for each AND or OR group ### Searching for Timestamp Fields @@ -4023,8 +4023,8 @@ See the [pagination section](https://developers.intercom.com/docs/build-an-integ You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). There are some limitations to the amount of multiple's there can be: -- There's a limit of max 2 nested filters -- There's a limit of max 15 filters for each AND or OR group +- There's a limit of max 2 nested filters +- There's a limit of max 15 filters for each AND or OR group ### Accepted Fields @@ -4278,14 +4278,14 @@ await client.conversations.reply({ For managing conversations you can: -- Close a conversation -- Snooze a conversation to reopen on a future date -- Open a conversation which is `snoozed` or `closed` -- Assign a conversation to an admin and/or team. - - - - +- Close a conversation +- Snooze a conversation to reopen on a future date +- Open a conversation which is `snoozed` or `closed` +- Assign a conversation to an admin and/or team. + + + + #### 🔌 Usage @@ -4921,9 +4921,9 @@ await client.dataAttributes.update({ The events belonging to a customer can be listed by sending a GET request to `https://api.intercom.io/events` with a user or lead identifier along with a `type` parameter. The identifier parameter can be one of `user_id`, `email` or `intercom_user_id`. The `type` parameter value must be `user`. -- `https://api.intercom.io/events?type=user&user_id={user_id}` -- `https://api.intercom.io/events?type=user&email={email}` -- `https://api.intercom.io/events?type=user&intercom_user_id={id}` (this call can be used to list leads) +- `https://api.intercom.io/events?type=user&user_id={user_id}` +- `https://api.intercom.io/events?type=user&email={email}` +- `https://api.intercom.io/events?type=user&intercom_user_id={id}` (this call can be used to list leads) The `email` parameter value should be [url encoded](http://en.wikipedia.org/wiki/Percent-encoding) when sending. @@ -5015,9 +5015,9 @@ When submitting events for Leads, you will need to specify the Lead's `id`. **Metadata behaviour** -- We currently limit the number of tracked metadata keys to 10 per event. Once the quota is reached, we ignore any further keys we receive. The first 10 metadata keys are determined by the order in which they are sent in with the event. -- It is not possible to change the metadata keys once the event has been sent. A new event will need to be created with the new keys and you can archive the old one. -- There might be up to 24 hrs delay when you send a new metadata for an existing event. +- We currently limit the number of tracked metadata keys to 10 per event. Once the quota is reached, we ignore any further keys we receive. The first 10 metadata keys are determined by the order in which they are sent in with the event. +- It is not possible to change the metadata keys once the event has been sent. A new event will need to be created with the new keys and you can archive the old one. +- There might be up to 24 hrs delay when you send a new metadata for an existing event. **Event de-duplication** @@ -5027,15 +5027,15 @@ Duplicated events are responded to using the normal `202 Accepted` code - an err ### HTTP API Responses -- Successful responses to submitted events return `202 Accepted` with an empty body. -- Unauthorised access will be rejected with a `401 Unauthorized` or `403 Forbidden` response code. -- Events sent about users that cannot be found will return a `404 Not Found`. -- Event lists containing duplicate events will have those duplicates ignored. -- Server errors will return a `500` response code and may contain an error message in the body. - - - - +- Successful responses to submitted events return `202 Accepted` with an empty body. +- Unauthorised access will be rejected with a `401 Unauthorized` or `403 Forbidden` response code. +- Events sent about users that cannot be found will return a `404 Not Found`. +- Event lists containing duplicate events will have those duplicates ignored. +- Server errors will return a `500` response code and may contain an error message in the body. + + + + #### 🔌 Usage @@ -6488,8 +6488,8 @@ See the [pagination section](https://developers.intercom.com/docs/build-an-integ You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4). There are some limitations to the amount of multiples there can be: -- There's a limit of max 2 nested filters -- There's a limit of max 15 filters for each AND or OR group +- There's a limit of max 2 nested filters +- There's a limit of max 15 filters for each AND or OR group ### Accepted Fields diff --git a/scripts/rename-to-esm-files.js b/scripts/rename-to-esm-files.js new file mode 100644 index 00000000..81dac6a7 --- /dev/null +++ b/scripts/rename-to-esm-files.js @@ -0,0 +1,115 @@ +#!/usr/bin/env node + +const fs = require("fs").promises; +const path = require("path"); + +const extensionMap = { + ".js": ".mjs", + ".d.ts": ".d.mts", +}; +const oldExtensions = Object.keys(extensionMap); + +async function findFiles(rootPath) { + const files = []; + + async function scan(directory) { + const entries = await fs.readdir(directory, { withFileTypes: true }); + + for (const entry of entries) { + const fullPath = path.join(directory, entry.name); + + if (entry.isDirectory()) { + if (entry.name !== "node_modules" && !entry.name.startsWith(".")) { + await scan(fullPath); + } + } else if (entry.isFile()) { + if (oldExtensions.some((ext) => entry.name.endsWith(ext))) { + files.push(fullPath); + } + } + } + } + + await scan(rootPath); + return files; +} + +async function updateFiles(files) { + const updatedFiles = []; + for (const file of files) { + const updated = await updateFileContents(file); + updatedFiles.push(updated); + } + + console.log(`Updated imports in ${updatedFiles.length} files.`); +} + +async function updateFileContents(file) { + const content = await fs.readFile(file, "utf8"); + + let newContent = content; + // Update each extension type defined in the map + for (const [oldExt, newExt] of Object.entries(extensionMap)) { + const regex = new RegExp(`(import|export)(.+from\\s+['"])(\\.\\.?\\/[^'"]+)(\\${oldExt})(['"])`, "g"); + newContent = newContent.replace(regex, `$1$2$3${newExt}$5`); + } + + if (content !== newContent) { + await fs.writeFile(file, newContent, "utf8"); + return true; + } + return false; +} + +async function renameFiles(files) { + let counter = 0; + for (const file of files) { + const ext = oldExtensions.find((ext) => file.endsWith(ext)); + const newExt = extensionMap[ext]; + + if (newExt) { + const newPath = file.slice(0, -ext.length) + newExt; + await fs.rename(file, newPath); + counter++; + } + } + + console.log(`Renamed ${counter} files.`); +} + +async function main() { + try { + const targetDir = process.argv[2]; + if (!targetDir) { + console.error("Please provide a target directory"); + process.exit(1); + } + + const targetPath = path.resolve(targetDir); + const targetStats = await fs.stat(targetPath); + + if (!targetStats.isDirectory()) { + console.error("The provided path is not a directory"); + process.exit(1); + } + + console.log(`Scanning directory: ${targetDir}`); + + const files = await findFiles(targetDir); + + if (files.length === 0) { + console.log("No matching files found."); + process.exit(0); + } + + console.log(`Found ${files.length} files.`); + await updateFiles(files); + await renameFiles(files); + console.log("\nDone!"); + } catch (error) { + console.error("An error occurred:", error.message); + process.exit(1); + } +} + +main(); diff --git a/src/Client.ts b/src/Client.ts index 3559a154..3e4a074b 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -26,8 +26,10 @@ import { Visitors } from "./api/resources/visitors/client/Client"; import { News } from "./api/resources/news/client/Client"; export declare namespace IntercomClient { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -52,7 +54,7 @@ export declare namespace IntercomClient { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ diff --git a/src/api/resources/admins/client/Client.ts b/src/api/resources/admins/client/Client.ts index 88778352..4a45597e 100644 --- a/src/api/resources/admins/client/Client.ts +++ b/src/api/resources/admins/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Admins { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Admins { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -89,16 +91,18 @@ export class Admins { public async identify(requestOptions?: Admins.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "me" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "me", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -154,21 +158,23 @@ export class Admins { */ public async away( request: Intercom.ConfigureAwayAdminRequest, - requestOptions?: Admins.RequestOptions + requestOptions?: Admins.RequestOptions, ): Promise { const { admin_id: adminId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `admins/${encodeURIComponent(adminId)}/away` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `admins/${encodeURIComponent(adminId)}/away`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -230,10 +236,10 @@ export class Admins { */ public async listAllActivityLogs( request: Intercom.ListAllActivityLogsRequest, - requestOptions?: Admins.RequestOptions + requestOptions?: Admins.RequestOptions, ): Promise { const { created_at_after: createdAtAfter, created_at_before: createdAtBefore } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; _queryParams["created_at_after"] = createdAtAfter; if (createdAtBefore != null) { _queryParams["created_at_before"] = createdAtBefore; @@ -241,16 +247,18 @@ export class Admins { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "admins/activity_logs" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "admins/activity_logs", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -307,16 +315,18 @@ export class Admins { public async list(requestOptions?: Admins.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "admins" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "admins", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -375,21 +385,23 @@ export class Admins { */ public async find( request: Intercom.FindAdminRequest, - requestOptions?: Admins.RequestOptions + requestOptions?: Admins.RequestOptions, ): Promise { const { admin_id: adminId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `admins/${encodeURIComponent(adminId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `admins/${encodeURIComponent(adminId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -438,7 +450,8 @@ export class Admins { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/articles/client/Client.ts b/src/api/resources/articles/client/Client.ts index 660e6d8c..f9b802c6 100644 --- a/src/api/resources/articles/client/Client.ts +++ b/src/api/resources/articles/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Articles { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Articles { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -90,11 +92,11 @@ export class Articles { */ public async list( request: Intercom.ListArticlesRequest = {}, - requestOptions?: Articles.RequestOptions + requestOptions?: Articles.RequestOptions, ): Promise> { const list = async (request: Intercom.ListArticlesRequest): Promise => { const { page, per_page: perPage } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (page != null) { _queryParams["page"] = page.toString(); } @@ -103,17 +105,18 @@ export class Articles { } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "articles" + "articles", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -207,20 +210,22 @@ export class Articles { */ public async create( request: Intercom.CreateArticleRequest, - requestOptions?: Articles.RequestOptions + requestOptions?: Articles.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "articles" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "articles", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -282,21 +287,23 @@ export class Articles { */ public async find( request: Intercom.FindArticleRequest, - requestOptions?: Articles.RequestOptions + requestOptions?: Articles.RequestOptions, ): Promise { const { article_id: articleId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `articles/${encodeURIComponent(articleId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `articles/${encodeURIComponent(articleId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -359,21 +366,23 @@ export class Articles { */ public async update( request: Intercom.UpdateArticleRequest, - requestOptions?: Articles.RequestOptions + requestOptions?: Articles.RequestOptions, ): Promise { const { article_id: articleId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `articles/${encodeURIComponent(articleId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `articles/${encodeURIComponent(articleId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -435,21 +444,23 @@ export class Articles { */ public async delete( request: Intercom.DeleteArticleRequest, - requestOptions?: Articles.RequestOptions + requestOptions?: Articles.RequestOptions, ): Promise { const { article_id: articleId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `articles/${encodeURIComponent(articleId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `articles/${encodeURIComponent(articleId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -510,10 +521,10 @@ export class Articles { */ public async search( request: Intercom.SearchArticlesRequest = {}, - requestOptions?: Articles.RequestOptions + requestOptions?: Articles.RequestOptions, ): Promise { const { phrase, state, help_center_id: helpCenterId, highlight } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (phrase != null) { _queryParams["phrase"] = phrase; } @@ -532,16 +543,18 @@ export class Articles { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "articles/search" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "articles/search", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -589,7 +602,8 @@ export class Articles { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/companies/client/Client.ts b/src/api/resources/companies/client/Client.ts index 9ff6fdb5..73e1367a 100644 --- a/src/api/resources/companies/client/Client.ts +++ b/src/api/resources/companies/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Companies { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Companies { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -102,10 +104,10 @@ export class Companies { */ public async retrieve( request: Intercom.RetrieveCompanyRequest = {}, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const { name, company_id: companyId, tag_id: tagId, segment_id: segmentId, page, per_page: perPage } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (name != null) { _queryParams["name"] = name; } @@ -132,16 +134,18 @@ export class Companies { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "companies" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "companies", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -216,20 +220,22 @@ export class Companies { */ public async createOrUpdate( request: Intercom.CreateOrUpdateCompanyRequest = {}, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "companies" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "companies", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -291,21 +297,23 @@ export class Companies { */ public async find( request: Intercom.FindCompanyRequest, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const { company_id: companyId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${encodeURIComponent(companyId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `companies/${encodeURIComponent(companyId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -370,21 +378,23 @@ export class Companies { */ public async update( request: Intercom.UpdateCompanyRequest, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const { company_id: companyId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${encodeURIComponent(companyId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `companies/${encodeURIComponent(companyId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -445,21 +455,23 @@ export class Companies { */ public async delete( request: Intercom.DeleteCompanyRequest, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const { company_id: companyId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${encodeURIComponent(companyId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `companies/${encodeURIComponent(companyId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -520,10 +532,10 @@ export class Companies { */ public async listAttachedContacts( request: Intercom.ListAttachedContactsRequest, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const { company_id: companyId, page, per_page: perPage } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (page != null) { _queryParams["page"] = page.toString(); } @@ -534,16 +546,18 @@ export class Companies { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${encodeURIComponent(companyId)}/contacts` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `companies/${encodeURIComponent(companyId)}/contacts`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -582,7 +596,7 @@ export class Companies { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /companies/{company_id}/contacts." + "Timeout exceeded when calling GET /companies/{company_id}/contacts.", ); case "unknown": throw new errors.IntercomError({ @@ -607,21 +621,23 @@ export class Companies { */ public async listAttachedSegments( request: Intercom.ListSegmentsAttachedToCompanyRequest, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const { company_id: companyId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${encodeURIComponent(companyId)}/segments` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `companies/${encodeURIComponent(companyId)}/segments`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -659,7 +675,7 @@ export class Companies { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /companies/{company_id}/segments." + "Timeout exceeded when calling GET /companies/{company_id}/segments.", ); case "unknown": throw new errors.IntercomError({ @@ -691,11 +707,11 @@ export class Companies { */ public async list( request: Intercom.ListCompaniesRequest = {}, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise> { const list = async (request: Intercom.ListCompaniesRequest): Promise => { const { page, per_page: perPage, order } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (page != null) { _queryParams["page"] = page.toString(); } @@ -707,17 +723,18 @@ export class Companies { } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "companies/list" + "companies/list", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -797,27 +814,28 @@ export class Companies { */ public async scroll( request: Intercom.ScrollCompaniesRequest = {}, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise> { const list = async (request: Intercom.ScrollCompaniesRequest): Promise => { const { scroll_param: scrollParam } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (scrollParam != null) { _queryParams["scroll_param"] = scrollParam; } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "companies/scroll" + "companies/scroll", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -898,21 +916,23 @@ export class Companies { */ public async attachContact( request: Intercom.AttachContactToCompanyRequest, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const { contact_id: contactId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/companies` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/companies`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -953,7 +973,7 @@ export class Companies { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /contacts/{contact_id}/companies." + "Timeout exceeded when calling POST /contacts/{contact_id}/companies.", ); case "unknown": throw new errors.IntercomError({ @@ -979,21 +999,23 @@ export class Companies { */ public async detachContact( request: Intercom.DetachContactFromCompanyRequest, - requestOptions?: Companies.RequestOptions + requestOptions?: Companies.RequestOptions, ): Promise { const { contact_id: contactId, company_id: companyId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/companies/${encodeURIComponent(companyId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/companies/${encodeURIComponent(companyId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1031,7 +1053,7 @@ export class Companies { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling DELETE /contacts/{contact_id}/companies/{company_id}." + "Timeout exceeded when calling DELETE /contacts/{contact_id}/companies/{company_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -1044,7 +1066,8 @@ export class Companies { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/contacts/client/Client.ts b/src/api/resources/contacts/client/Client.ts index 28fae748..2f4b253e 100644 --- a/src/api/resources/contacts/client/Client.ts +++ b/src/api/resources/contacts/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Contacts { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Contacts { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -89,13 +91,13 @@ export class Contacts { */ public async listAttachedCompanies( request: Intercom.ListAttachedCompaniesRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise> { const list = async ( - request: Intercom.ListAttachedCompaniesRequest + request: Intercom.ListAttachedCompaniesRequest, ): Promise => { const { contact_id: contactId, page, per_page: perPage } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (page != null) { _queryParams["page"] = page.toString(); } @@ -104,17 +106,18 @@ export class Contacts { } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/companies` + `contacts/${encodeURIComponent(contactId)}/companies`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -151,7 +154,7 @@ export class Contacts { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /contacts/{contact_id}/companies." + "Timeout exceeded when calling GET /contacts/{contact_id}/companies.", ); case "unknown": throw new errors.IntercomError({ @@ -187,21 +190,23 @@ export class Contacts { */ public async listAttachedSegments( request: Intercom.ListSegmentsAttachedToContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/segments` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/segments`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -239,7 +244,7 @@ export class Contacts { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /contacts/{contact_id}/segments." + "Timeout exceeded when calling GET /contacts/{contact_id}/segments.", ); case "unknown": throw new errors.IntercomError({ @@ -270,21 +275,23 @@ export class Contacts { */ public async listAttachedSubscriptions( request: Intercom.ListAttachedSubscriptionsRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/subscriptions` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/subscriptions`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -322,7 +329,7 @@ export class Contacts { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /contacts/{contact_id}/subscriptions." + "Timeout exceeded when calling GET /contacts/{contact_id}/subscriptions.", ); case "unknown": throw new errors.IntercomError({ @@ -362,21 +369,23 @@ export class Contacts { */ public async attachSubscription( request: Intercom.AttachSubscriptionToContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/subscriptions` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/subscriptions`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -415,7 +424,7 @@ export class Contacts { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /contacts/{contact_id}/subscriptions." + "Timeout exceeded when calling POST /contacts/{contact_id}/subscriptions.", ); case "unknown": throw new errors.IntercomError({ @@ -441,21 +450,23 @@ export class Contacts { */ public async detachSubscription( request: Intercom.DetachSubscriptionFromContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId, subscription_id: subscriptionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/subscriptions/${encodeURIComponent(subscriptionId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/subscriptions/${encodeURIComponent(subscriptionId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -493,7 +504,7 @@ export class Contacts { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling DELETE /contacts/{contact_id}/subscriptions/{subscription_id}." + "Timeout exceeded when calling DELETE /contacts/{contact_id}/subscriptions/{subscription_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -518,21 +529,23 @@ export class Contacts { */ public async listAttachedTags( request: Intercom.ListTagsAttachedToContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/tags` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/tags`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -592,21 +605,23 @@ export class Contacts { */ public async find( request: Intercom.FindContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -666,21 +681,23 @@ export class Contacts { */ public async update( request: Intercom.UpdateContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -739,21 +756,23 @@ export class Contacts { */ public async delete( request: Intercom.DeleteContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -812,20 +831,22 @@ export class Contacts { */ public async mergeLeadInUser( request: Intercom.MergeContactsRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "contacts/merge" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "contacts/merge", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -992,22 +1013,23 @@ export class Contacts { */ public async search( request: Intercom.SearchRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise> { const list = async (request: Intercom.SearchRequest): Promise => { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "contacts/search" + "contacts/search", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1054,7 +1076,7 @@ export class Contacts { getItems: (response) => response?.data ?? [], loadPage: (response) => { return list( - core.setObjectProperty(request, "pagination.starting_after", response?.pages?.next?.starting_after) + core.setObjectProperty(request, "pagination.starting_after", response?.pages?.next?.starting_after), ); }, }); @@ -1077,11 +1099,11 @@ export class Contacts { */ public async list( request: Intercom.ListContactsRequest = {}, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise> { const list = async (request: Intercom.ListContactsRequest): Promise => { const { page, per_page: perPage, starting_after: startingAfter } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (page != null) { _queryParams["page"] = page.toString(); } @@ -1093,17 +1115,18 @@ export class Contacts { } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "contacts" + "contacts", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1169,20 +1192,22 @@ export class Contacts { */ public async create( request: Intercom.CreateContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "contacts" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "contacts", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1239,21 +1264,23 @@ export class Contacts { */ public async archive( request: Intercom.ArchiveContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/archive` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/archive`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1284,7 +1311,7 @@ export class Contacts { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /contacts/{contact_id}/archive." + "Timeout exceeded when calling POST /contacts/{contact_id}/archive.", ); case "unknown": throw new errors.IntercomError({ @@ -1306,21 +1333,23 @@ export class Contacts { */ public async unarchive( request: Intercom.UnarchiveContactRequest, - requestOptions?: Contacts.RequestOptions + requestOptions?: Contacts.RequestOptions, ): Promise { const { contact_id: contactId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/unarchive` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/unarchive`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1351,7 +1380,7 @@ export class Contacts { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /contacts/{contact_id}/unarchive." + "Timeout exceeded when calling POST /contacts/{contact_id}/unarchive.", ); case "unknown": throw new errors.IntercomError({ @@ -1364,7 +1393,8 @@ export class Contacts { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/conversations/client/Client.ts b/src/api/resources/conversations/client/Client.ts index df170958..5e35fcec 100644 --- a/src/api/resources/conversations/client/Client.ts +++ b/src/api/resources/conversations/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Conversations { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Conversations { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -93,13 +95,13 @@ export class Conversations { */ public async list( request: Intercom.ListConversationsRequest = {}, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise> { const list = async ( - request: Intercom.ListConversationsRequest + request: Intercom.ListConversationsRequest, ): Promise => { const { per_page: perPage, starting_after: startingAfter } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (perPage != null) { _queryParams["per_page"] = perPage.toString(); } @@ -108,17 +110,18 @@ export class Conversations { } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "conversations" + "conversations", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -209,20 +212,22 @@ export class Conversations { */ public async create( request: Intercom.CreateConversationRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "conversations" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "conversations", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -297,26 +302,28 @@ export class Conversations { */ public async find( request: Intercom.FindConversationRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const { conversation_id: conversationId, display_as: displayAs } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (displayAs != null) { _queryParams["display_as"] = displayAs; } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -357,7 +364,7 @@ export class Conversations { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /conversations/{conversation_id}." + "Timeout exceeded when calling GET /conversations/{conversation_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -394,26 +401,28 @@ export class Conversations { */ public async update( request: Intercom.UpdateConversationRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const { conversation_id: conversationId, display_as: displayAs, ..._body } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (displayAs != null) { _queryParams["display_as"] = displayAs; } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -455,7 +464,7 @@ export class Conversations { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling PUT /conversations/{conversation_id}." + "Timeout exceeded when calling PUT /conversations/{conversation_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -585,22 +594,23 @@ export class Conversations { */ public async search( request: Intercom.SearchRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise> { const list = async (request: Intercom.SearchRequest): Promise => { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "conversations/search" + "conversations/search", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -642,7 +652,7 @@ export class Conversations { getItems: (response) => response?.conversations ?? [], loadPage: (response) => { return list( - core.setObjectProperty(request, "pagination.starting_after", response?.pages?.next?.starting_after) + core.setObjectProperty(request, "pagination.starting_after", response?.pages?.next?.starting_after), ); }, }); @@ -704,21 +714,23 @@ export class Conversations { */ public async reply( request: Intercom.ReplyToConversationRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const { conversation_id: conversationId, body: _body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/reply` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/reply`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -759,7 +771,7 @@ export class Conversations { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /conversations/{conversation_id}/reply." + "Timeout exceeded when calling POST /conversations/{conversation_id}/reply.", ); case "unknown": throw new errors.IntercomError({ @@ -824,21 +836,23 @@ export class Conversations { */ public async manage( request: Intercom.ManageConversationPartsRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const { conversation_id: conversationId, body: _body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/parts` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/parts`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -879,7 +893,7 @@ export class Conversations { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /conversations/{conversation_id}/parts." + "Timeout exceeded when calling POST /conversations/{conversation_id}/parts.", ); case "unknown": throw new errors.IntercomError({ @@ -911,21 +925,23 @@ export class Conversations { */ public async runAssignmentRules( request: Intercom.AutoAssignConversationRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const { conversation_id: conversationId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/run_assignment_rules` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/run_assignment_rules`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -965,7 +981,7 @@ export class Conversations { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /conversations/{conversation_id}/run_assignment_rules." + "Timeout exceeded when calling POST /conversations/{conversation_id}/run_assignment_rules.", ); case "unknown": throw new errors.IntercomError({ @@ -1008,21 +1024,23 @@ export class Conversations { */ public async attachContactAsAdmin( request: Intercom.AttachContactToConversationRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const { conversation_id: conversationId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/customers` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/customers`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1063,7 +1081,7 @@ export class Conversations { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /conversations/{conversation_id}/customers." + "Timeout exceeded when calling POST /conversations/{conversation_id}/customers.", ); case "unknown": throw new errors.IntercomError({ @@ -1096,21 +1114,23 @@ export class Conversations { */ public async detachContactAsAdmin( request: Intercom.DetachContactFromConversationRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const { conversation_id: conversationId, contact_id: contactId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/customers/${encodeURIComponent(contactId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/customers/${encodeURIComponent(contactId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1153,7 +1173,7 @@ export class Conversations { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling DELETE /conversations/{conversation_id}/customers/{contact_id}." + "Timeout exceeded when calling DELETE /conversations/{conversation_id}/customers/{contact_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -1191,20 +1211,22 @@ export class Conversations { */ public async redactConversationPart( request: Intercom.RedactConversationRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "conversations/redact" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "conversations/redact", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1272,21 +1294,23 @@ export class Conversations { */ public async convertToTicket( request: Intercom.ConvertConversationToTicketRequest, - requestOptions?: Conversations.RequestOptions + requestOptions?: Conversations.RequestOptions, ): Promise { const { conversation_id: conversationId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/convert` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/convert`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -1323,7 +1347,7 @@ export class Conversations { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /conversations/{conversation_id}/convert." + "Timeout exceeded when calling POST /conversations/{conversation_id}/convert.", ); case "unknown": throw new errors.IntercomError({ @@ -1336,7 +1360,8 @@ export class Conversations { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/dataAttributes/client/Client.ts b/src/api/resources/dataAttributes/client/Client.ts index 303e547a..614d3359 100644 --- a/src/api/resources/dataAttributes/client/Client.ts +++ b/src/api/resources/dataAttributes/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace DataAttributes { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace DataAttributes { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -86,10 +88,10 @@ export class DataAttributes { */ public async list( request: Intercom.ListDataAttributesRequest = {}, - requestOptions?: DataAttributes.RequestOptions + requestOptions?: DataAttributes.RequestOptions, ): Promise { const { model, include_archived: includeArchived } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (model != null) { _queryParams["model"] = model; } @@ -100,16 +102,18 @@ export class DataAttributes { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "data_attributes" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "data_attributes", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -208,20 +212,22 @@ export class DataAttributes { */ public async create( request: Intercom.CreateDataAttributeRequest, - requestOptions?: DataAttributes.RequestOptions + requestOptions?: DataAttributes.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "data_attributes" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "data_attributes", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -316,21 +322,23 @@ export class DataAttributes { */ public async update( request: Intercom.UpdateDataAttributeRequest, - requestOptions?: DataAttributes.RequestOptions + requestOptions?: DataAttributes.RequestOptions, ): Promise { const { data_attribute_id: dataAttributeId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `data_attributes/${encodeURIComponent(dataAttributeId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `data_attributes/${encodeURIComponent(dataAttributeId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -373,7 +381,7 @@ export class DataAttributes { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling PUT /data_attributes/{data_attribute_id}." + "Timeout exceeded when calling PUT /data_attributes/{data_attribute_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -386,7 +394,8 @@ export class DataAttributes { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/dataExport/client/Client.ts b/src/api/resources/dataExport/client/Client.ts index 1696efc0..548a7df9 100644 --- a/src/api/resources/dataExport/client/Client.ts +++ b/src/api/resources/dataExport/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace DataExport { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace DataExport { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -101,20 +103,22 @@ export class DataExport { */ public async create( request: Intercom.CreateDataExportRequest, - requestOptions?: DataExport.RequestOptions + requestOptions?: DataExport.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "export/content/data" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "export/content/data", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -170,21 +174,23 @@ export class DataExport { */ public async find( request: Intercom.FindDataExportRequest, - requestOptions?: DataExport.RequestOptions + requestOptions?: DataExport.RequestOptions, ): Promise { const { job_identifier: jobIdentifier } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `export/content/data/${encodeURIComponent(jobIdentifier)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `export/content/data/${encodeURIComponent(jobIdentifier)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -215,7 +221,7 @@ export class DataExport { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /export/content/data/{job_identifier}." + "Timeout exceeded when calling GET /export/content/data/{job_identifier}.", ); case "unknown": throw new errors.IntercomError({ @@ -237,21 +243,23 @@ export class DataExport { */ public async cancel( request: Intercom.CancelDataExportRequest, - requestOptions?: DataExport.RequestOptions + requestOptions?: DataExport.RequestOptions, ): Promise { const { job_identifier: jobIdentifier } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `export/cancel/${encodeURIComponent(jobIdentifier)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `export/cancel/${encodeURIComponent(jobIdentifier)}`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -282,7 +290,7 @@ export class DataExport { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /export/cancel/{job_identifier}." + "Timeout exceeded when calling POST /export/cancel/{job_identifier}.", ); case "unknown": throw new errors.IntercomError({ @@ -310,21 +318,23 @@ export class DataExport { */ public async download( request: Intercom.DownloadDataExportRequest, - requestOptions?: DataExport.RequestOptions + requestOptions?: DataExport.RequestOptions, ): Promise { const { job_identifier: jobIdentifier } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `download/content/data/${encodeURIComponent(jobIdentifier)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `download/content/data/${encodeURIComponent(jobIdentifier)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -355,7 +365,7 @@ export class DataExport { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /download/content/data/{job_identifier}." + "Timeout exceeded when calling GET /download/content/data/{job_identifier}.", ); case "unknown": throw new errors.IntercomError({ @@ -368,7 +378,8 @@ export class DataExport { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/events/client/Client.ts b/src/api/resources/events/client/Client.ts index d4fcbd97..8afe9b6a 100644 --- a/src/api/resources/events/client/Client.ts +++ b/src/api/resources/events/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Events { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Events { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -98,7 +100,7 @@ export class Events { */ public async list( request: Intercom.ListEventsRequest, - requestOptions?: Events.RequestOptions + requestOptions?: Events.RequestOptions, ): Promise { const { user_id: userId, @@ -108,7 +110,7 @@ export class Events { summary, per_page: perPage, } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (userId != null) { _queryParams["user_id"] = userId; } @@ -132,16 +134,18 @@ export class Events { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "events" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "events", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -242,20 +246,22 @@ export class Events { */ public async create( request: Intercom.CreateDataEventRequest, - requestOptions?: Events.RequestOptions + requestOptions?: Events.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "events" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "events", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -312,20 +318,22 @@ export class Events { */ public async summaries( request: Intercom.ListEventSummariesRequest = {}, - requestOptions?: Events.RequestOptions + requestOptions?: Events.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "events/summaries" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "events/summaries", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -373,7 +381,8 @@ export class Events { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/helpCenters/client/Client.ts b/src/api/resources/helpCenters/client/Client.ts index a0e94871..a6e12499 100644 --- a/src/api/resources/helpCenters/client/Client.ts +++ b/src/api/resources/helpCenters/client/Client.ts @@ -10,8 +10,10 @@ import * as errors from "../../../../errors/index"; import { Collections } from "../resources/collections/client/Client"; export declare namespace HelpCenters { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -36,7 +38,7 @@ export declare namespace HelpCenters { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -93,21 +95,23 @@ export class HelpCenters { */ public async find( request: Intercom.FindHelpCenterRequest, - requestOptions?: HelpCenters.RequestOptions + requestOptions?: HelpCenters.RequestOptions, ): Promise { const { help_center_id: helpCenterId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/help_centers/${encodeURIComponent(helpCenterId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `help_center/help_centers/${encodeURIComponent(helpCenterId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -145,7 +149,7 @@ export class HelpCenters { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /help_center/help_centers/{help_center_id}." + "Timeout exceeded when calling GET /help_center/help_centers/{help_center_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -167,11 +171,11 @@ export class HelpCenters { */ public async list( request: Intercom.ListHelpCentersRequest = {}, - requestOptions?: HelpCenters.RequestOptions + requestOptions?: HelpCenters.RequestOptions, ): Promise> { const list = async (request: Intercom.ListHelpCentersRequest): Promise => { const { page, per_page: perPage } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (page != null) { _queryParams["page"] = page.toString(); } @@ -180,17 +184,18 @@ export class HelpCenters { } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "help_center/help_centers" + "help_center/help_centers", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -225,7 +230,7 @@ export class HelpCenters { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /help_center/help_centers." + "Timeout exceeded when calling GET /help_center/help_centers.", ); case "unknown": throw new errors.IntercomError({ @@ -249,7 +254,8 @@ export class HelpCenters { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/helpCenters/resources/collections/client/Client.ts b/src/api/resources/helpCenters/resources/collections/client/Client.ts index 1daef23b..a7f5a013 100644 --- a/src/api/resources/helpCenters/resources/collections/client/Client.ts +++ b/src/api/resources/helpCenters/resources/collections/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../../../errors/index"; export declare namespace Collections { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Collections { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -85,11 +87,11 @@ export class Collections { */ public async list( request: Intercom.helpCenters.ListCollectionsRequest = {}, - requestOptions?: Collections.RequestOptions + requestOptions?: Collections.RequestOptions, ): Promise> { const list = async (request: Intercom.helpCenters.ListCollectionsRequest): Promise => { const { page, per_page: perPage } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (page != null) { _queryParams["page"] = page.toString(); } @@ -98,17 +100,18 @@ export class Collections { } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "help_center/collections" + "help_center/collections", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -143,7 +146,7 @@ export class Collections { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /help_center/collections." + "Timeout exceeded when calling GET /help_center/collections.", ); case "unknown": throw new errors.IntercomError({ @@ -185,20 +188,22 @@ export class Collections { */ public async create( request: Intercom.helpCenters.CreateCollectionRequest, - requestOptions?: Collections.RequestOptions + requestOptions?: Collections.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "help_center/collections" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "help_center/collections", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -260,21 +265,23 @@ export class Collections { */ public async find( request: Intercom.helpCenters.FindCollectionRequest, - requestOptions?: Collections.RequestOptions + requestOptions?: Collections.RequestOptions, ): Promise { const { collection_id: collectionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${encodeURIComponent(collectionId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `help_center/collections/${encodeURIComponent(collectionId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -312,7 +319,7 @@ export class Collections { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /help_center/collections/{collection_id}." + "Timeout exceeded when calling GET /help_center/collections/{collection_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -338,21 +345,23 @@ export class Collections { */ public async update( request: Intercom.helpCenters.UpdateCollectionRequest, - requestOptions?: Collections.RequestOptions + requestOptions?: Collections.RequestOptions, ): Promise { const { collection_id: collectionId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${encodeURIComponent(collectionId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `help_center/collections/${encodeURIComponent(collectionId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -391,7 +400,7 @@ export class Collections { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling PUT /help_center/collections/{collection_id}." + "Timeout exceeded when calling PUT /help_center/collections/{collection_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -416,21 +425,23 @@ export class Collections { */ public async delete( request: Intercom.helpCenters.DeleteCollectionRequest, - requestOptions?: Collections.RequestOptions + requestOptions?: Collections.RequestOptions, ): Promise { const { collection_id: collectionId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${encodeURIComponent(collectionId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `help_center/collections/${encodeURIComponent(collectionId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -468,7 +479,7 @@ export class Collections { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling DELETE /help_center/collections/{collection_id}." + "Timeout exceeded when calling DELETE /help_center/collections/{collection_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -481,7 +492,8 @@ export class Collections { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/messages/client/Client.ts b/src/api/resources/messages/client/Client.ts index e5ed8541..28f5c2f2 100644 --- a/src/api/resources/messages/client/Client.ts +++ b/src/api/resources/messages/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Messages { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Messages { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -166,20 +168,22 @@ export class Messages { */ public async create( request: Intercom.CreateMessageRequest, - requestOptions?: Messages.RequestOptions + requestOptions?: Messages.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "messages" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "messages", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -233,7 +237,8 @@ export class Messages { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/news/client/Client.ts b/src/api/resources/news/client/Client.ts index 22771259..2b6dd6ab 100644 --- a/src/api/resources/news/client/Client.ts +++ b/src/api/resources/news/client/Client.ts @@ -8,8 +8,10 @@ import { Items } from "../resources/items/client/Client"; import { Feeds } from "../resources/feeds/client/Client"; export declare namespace News { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -33,37 +35,6 @@ export declare namespace News { | "Unstable"; fetcher?: core.FetchFunction; } - - interface RequestOptions { - /** The maximum time to wait for a response in seconds. */ - timeoutInSeconds?: number; - /** The number of times to retry the request. Defaults to 2. */ - maxRetries?: number; - /** A hook to abort the request. */ - abortSignal?: AbortSignal; - /** Additional headers to include in the request. */ - headers?: Record; - /** Override the Intercom-Version header */ - version?: - | "1.0" - | "1.1" - | "1.2" - | "1.3" - | "1.4" - | "2.0" - | "2.1" - | "2.2" - | "2.3" - | "2.4" - | "2.5" - | "2.6" - | "2.7" - | "2.8" - | "2.9" - | "2.10" - | "2.11" - | "Unstable"; - } } export class News { diff --git a/src/api/resources/news/resources/feeds/client/Client.ts b/src/api/resources/news/resources/feeds/client/Client.ts index 010b3fe8..f9135b81 100644 --- a/src/api/resources/news/resources/feeds/client/Client.ts +++ b/src/api/resources/news/resources/feeds/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../../../errors/index"; export declare namespace Feeds { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Feeds { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -85,21 +87,23 @@ export class Feeds { */ public async listItems( request: Intercom.news.ListNewsFeedItemsRequest, - requestOptions?: Feeds.RequestOptions + requestOptions?: Feeds.RequestOptions, ): Promise { const { newsfeed_id: newsfeedId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/newsfeeds/${encodeURIComponent(newsfeedId)}/items` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `news/newsfeeds/${encodeURIComponent(newsfeedId)}/items`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -135,7 +139,7 @@ export class Feeds { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /news/newsfeeds/{newsfeed_id}/items." + "Timeout exceeded when calling GET /news/newsfeeds/{newsfeed_id}/items.", ); case "unknown": throw new errors.IntercomError({ @@ -157,16 +161,18 @@ export class Feeds { public async list(requestOptions?: Feeds.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "news/newsfeeds" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "news/newsfeeds", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -224,21 +230,23 @@ export class Feeds { */ public async find( request: Intercom.news.FindNewsFeedRequest, - requestOptions?: Feeds.RequestOptions + requestOptions?: Feeds.RequestOptions, ): Promise { const { newsfeed_id: newsfeedId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/newsfeeds/${encodeURIComponent(newsfeedId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `news/newsfeeds/${encodeURIComponent(newsfeedId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -274,7 +282,7 @@ export class Feeds { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /news/newsfeeds/{newsfeed_id}." + "Timeout exceeded when calling GET /news/newsfeeds/{newsfeed_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -287,7 +295,8 @@ export class Feeds { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/news/resources/items/client/Client.ts b/src/api/resources/news/resources/items/client/Client.ts index feaf5a90..56023030 100644 --- a/src/api/resources/news/resources/items/client/Client.ts +++ b/src/api/resources/news/resources/items/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../../../errors/index"; export declare namespace Items { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Items { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -83,16 +85,18 @@ export class Items { public async list(requestOptions?: Items.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "news/news_items" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "news/news_items", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -160,20 +164,22 @@ export class Items { */ public async create( request: Intercom.NewsItemRequest, - requestOptions?: Items.RequestOptions + requestOptions?: Items.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "news/news_items" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "news/news_items", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -233,21 +239,23 @@ export class Items { */ public async find( request: Intercom.news.FindNewsItemRequest, - requestOptions?: Items.RequestOptions + requestOptions?: Items.RequestOptions, ): Promise { const { news_item_id: newsItemId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${encodeURIComponent(newsItemId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `news/news_items/${encodeURIComponent(newsItemId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -285,7 +293,7 @@ export class Items { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /news/news_items/{news_item_id}." + "Timeout exceeded when calling GET /news/news_items/{news_item_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -325,21 +333,23 @@ export class Items { */ public async update( request: Intercom.news.UpdateNewsItemRequest, - requestOptions?: Items.RequestOptions + requestOptions?: Items.RequestOptions, ): Promise { const { news_item_id: newsItemId, body: _body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${encodeURIComponent(newsItemId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `news/news_items/${encodeURIComponent(newsItemId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -378,7 +388,7 @@ export class Items { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling PUT /news/news_items/{news_item_id}." + "Timeout exceeded when calling PUT /news/news_items/{news_item_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -403,21 +413,23 @@ export class Items { */ public async delete( request: Intercom.news.DeleteNewsItemRequest, - requestOptions?: Items.RequestOptions + requestOptions?: Items.RequestOptions, ): Promise { const { news_item_id: newsItemId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${encodeURIComponent(newsItemId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `news/news_items/${encodeURIComponent(newsItemId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -455,7 +467,7 @@ export class Items { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling DELETE /news/news_items/{news_item_id}." + "Timeout exceeded when calling DELETE /news/news_items/{news_item_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -468,7 +480,8 @@ export class Items { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/notes/client/Client.ts b/src/api/resources/notes/client/Client.ts index b023e823..8271ea3f 100644 --- a/src/api/resources/notes/client/Client.ts +++ b/src/api/resources/notes/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Notes { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Notes { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -88,11 +90,11 @@ export class Notes { */ public async list( request: Intercom.ListContactNotesRequest, - requestOptions?: Notes.RequestOptions + requestOptions?: Notes.RequestOptions, ): Promise> { const list = async (request: Intercom.ListContactNotesRequest): Promise => { const { contact_id: contactId, page, per_page: perPage } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (page != null) { _queryParams["page"] = page.toString(); } @@ -101,17 +103,18 @@ export class Notes { } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/notes` + `contacts/${encodeURIComponent(contactId)}/notes`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -146,7 +149,7 @@ export class Notes { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /contacts/{contact_id}/notes." + "Timeout exceeded when calling GET /contacts/{contact_id}/notes.", ); case "unknown": throw new errors.IntercomError({ @@ -183,21 +186,23 @@ export class Notes { */ public async create( request: Intercom.CreateContactNoteRequest, - requestOptions?: Notes.RequestOptions + requestOptions?: Notes.RequestOptions, ): Promise { const { contact_id: contactId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/notes` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/notes`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -234,7 +239,7 @@ export class Notes { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /contacts/{contact_id}/notes." + "Timeout exceeded when calling POST /contacts/{contact_id}/notes.", ); case "unknown": throw new errors.IntercomError({ @@ -259,21 +264,23 @@ export class Notes { */ public async find( request: Intercom.FindNoteRequest, - requestOptions?: Notes.RequestOptions + requestOptions?: Notes.RequestOptions, ): Promise { const { note_id: noteId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `notes/${encodeURIComponent(noteId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `notes/${encodeURIComponent(noteId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -322,7 +329,8 @@ export class Notes { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/phoneCallRedirects/client/Client.ts b/src/api/resources/phoneCallRedirects/client/Client.ts index 8ab07914..f8cc8e05 100644 --- a/src/api/resources/phoneCallRedirects/client/Client.ts +++ b/src/api/resources/phoneCallRedirects/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace PhoneCallRedirects { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace PhoneCallRedirects { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -103,20 +105,22 @@ export class PhoneCallRedirects { */ public async create( request: Intercom.CreatePhoneCallRedirectRequest, - requestOptions?: PhoneCallRedirects.RequestOptions + requestOptions?: PhoneCallRedirects.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "phone_call_redirects" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "phone_call_redirects", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -168,7 +172,8 @@ export class PhoneCallRedirects { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/segments/client/Client.ts b/src/api/resources/segments/client/Client.ts index 9a980a78..b83e7b81 100644 --- a/src/api/resources/segments/client/Client.ts +++ b/src/api/resources/segments/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Segments { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Segments { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -86,26 +88,28 @@ export class Segments { */ public async list( request: Intercom.ListSegmentsRequest = {}, - requestOptions?: Segments.RequestOptions + requestOptions?: Segments.RequestOptions, ): Promise { const { include_count: includeCount } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; if (includeCount != null) { _queryParams["include_count"] = includeCount.toString(); } const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "segments" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "segments", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -165,21 +169,23 @@ export class Segments { */ public async find( request: Intercom.FindSegmentRequest, - requestOptions?: Segments.RequestOptions + requestOptions?: Segments.RequestOptions, ): Promise { const { segment_id: segmentId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `segments/${encodeURIComponent(segmentId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `segments/${encodeURIComponent(segmentId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -228,7 +234,8 @@ export class Segments { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/subscriptionTypes/client/Client.ts b/src/api/resources/subscriptionTypes/client/Client.ts index 249ba181..28ed27ea 100644 --- a/src/api/resources/subscriptionTypes/client/Client.ts +++ b/src/api/resources/subscriptionTypes/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace SubscriptionTypes { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace SubscriptionTypes { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -86,16 +88,18 @@ export class SubscriptionTypes { public async list(requestOptions?: SubscriptionTypes.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "subscription_types" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "subscription_types", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -142,7 +146,8 @@ export class SubscriptionTypes { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/tags/client/Client.ts b/src/api/resources/tags/client/Client.ts index 68729f8a..4cb3a183 100644 --- a/src/api/resources/tags/client/Client.ts +++ b/src/api/resources/tags/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Tags { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Tags { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -96,21 +98,23 @@ export class Tags { */ public async tagContact( request: Intercom.TagContactRequest, - requestOptions?: Tags.RequestOptions + requestOptions?: Tags.RequestOptions, ): Promise { const { contact_id: contactId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/tags` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/tags`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -149,7 +153,7 @@ export class Tags { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /contacts/{contact_id}/tags." + "Timeout exceeded when calling POST /contacts/{contact_id}/tags.", ); case "unknown": throw new errors.IntercomError({ @@ -175,21 +179,23 @@ export class Tags { */ public async untagContact( request: Intercom.UntagContactRequest, - requestOptions?: Tags.RequestOptions + requestOptions?: Tags.RequestOptions, ): Promise { const { contact_id: contactId, tag_id: tagId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${encodeURIComponent(contactId)}/tags/${encodeURIComponent(tagId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `contacts/${encodeURIComponent(contactId)}/tags/${encodeURIComponent(tagId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -227,7 +233,7 @@ export class Tags { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling DELETE /contacts/{contact_id}/tags/{tag_id}." + "Timeout exceeded when calling DELETE /contacts/{contact_id}/tags/{tag_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -254,21 +260,23 @@ export class Tags { */ public async tagConversation( request: Intercom.TagConversationRequest, - requestOptions?: Tags.RequestOptions + requestOptions?: Tags.RequestOptions, ): Promise { const { conversation_id: conversationId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/tags` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/tags`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -307,7 +315,7 @@ export class Tags { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /conversations/{conversation_id}/tags." + "Timeout exceeded when calling POST /conversations/{conversation_id}/tags.", ); case "unknown": throw new errors.IntercomError({ @@ -334,21 +342,23 @@ export class Tags { */ public async untagConversation( request: Intercom.UntagConversationRequest, - requestOptions?: Tags.RequestOptions + requestOptions?: Tags.RequestOptions, ): Promise { const { conversation_id: conversationId, tag_id: tagId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${encodeURIComponent(conversationId)}/tags/${encodeURIComponent(tagId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `conversations/${encodeURIComponent(conversationId)}/tags/${encodeURIComponent(tagId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -387,7 +397,7 @@ export class Tags { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling DELETE /conversations/{conversation_id}/tags/{tag_id}." + "Timeout exceeded when calling DELETE /conversations/{conversation_id}/tags/{tag_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -409,16 +419,18 @@ export class Tags { public async list(requestOptions?: Tags.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "tags" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "tags", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -511,20 +523,22 @@ export class Tags { */ public async create( request: Intercom.TagsCreateRequestBody, - requestOptions?: Tags.RequestOptions + requestOptions?: Tags.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "tags" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "tags", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -591,16 +605,18 @@ export class Tags { const { tag_id: tagId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tags/${encodeURIComponent(tagId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `tags/${encodeURIComponent(tagId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -664,16 +680,18 @@ export class Tags { const { tag_id: tagId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tags/${encodeURIComponent(tagId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `tags/${encodeURIComponent(tagId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -738,21 +756,23 @@ export class Tags { */ public async tagTicket( request: Intercom.TagTicketRequest, - requestOptions?: Tags.RequestOptions + requestOptions?: Tags.RequestOptions, ): Promise { const { ticket_id: ticketId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${encodeURIComponent(ticketId)}/tags` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `tickets/${encodeURIComponent(ticketId)}/tags`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -816,21 +836,23 @@ export class Tags { */ public async untagTicket( request: Intercom.UntagTicketRequest, - requestOptions?: Tags.RequestOptions + requestOptions?: Tags.RequestOptions, ): Promise { const { ticket_id: ticketId, tag_id: tagId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${encodeURIComponent(ticketId)}/tags/${encodeURIComponent(tagId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `tickets/${encodeURIComponent(ticketId)}/tags/${encodeURIComponent(tagId)}`, ), method: "DELETE", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -869,7 +891,7 @@ export class Tags { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling DELETE /tickets/{ticket_id}/tags/{tag_id}." + "Timeout exceeded when calling DELETE /tickets/{ticket_id}/tags/{tag_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -882,7 +904,8 @@ export class Tags { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/teams/client/Client.ts b/src/api/resources/teams/client/Client.ts index 3aa7071c..468b8b04 100644 --- a/src/api/resources/teams/client/Client.ts +++ b/src/api/resources/teams/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Teams { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Teams { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -86,16 +88,18 @@ export class Teams { public async list(requestOptions?: Teams.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "teams" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "teams", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -154,21 +158,23 @@ export class Teams { */ public async find( request: Intercom.FindTeamRequest, - requestOptions?: Teams.RequestOptions + requestOptions?: Teams.RequestOptions, ): Promise { const { team_id: teamId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `teams/${encodeURIComponent(teamId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `teams/${encodeURIComponent(teamId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -217,7 +223,8 @@ export class Teams { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/ticketTypes/client/Client.ts b/src/api/resources/ticketTypes/client/Client.ts index 53ca5a78..db370a8b 100644 --- a/src/api/resources/ticketTypes/client/Client.ts +++ b/src/api/resources/ticketTypes/client/Client.ts @@ -10,8 +10,10 @@ import * as errors from "../../../../errors/index"; import { Attributes } from "../resources/attributes/client/Client"; export declare namespace TicketTypes { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -36,7 +38,7 @@ export declare namespace TicketTypes { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -93,16 +95,18 @@ export class TicketTypes { public async list(requestOptions?: TicketTypes.RequestOptions): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "ticket_types" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "ticket_types", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -167,20 +171,22 @@ export class TicketTypes { */ public async create( request: Intercom.CreateTicketTypeRequest, - requestOptions?: TicketTypes.RequestOptions + requestOptions?: TicketTypes.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "ticket_types" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "ticket_types", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -239,21 +245,23 @@ export class TicketTypes { */ public async get( request: Intercom.FindTicketTypeRequest, - requestOptions?: TicketTypes.RequestOptions + requestOptions?: TicketTypes.RequestOptions, ): Promise { const { ticket_type_id: ticketTypeId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${encodeURIComponent(ticketTypeId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ticket_types/${encodeURIComponent(ticketTypeId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -289,7 +297,7 @@ export class TicketTypes { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling GET /ticket_types/{ticket_type_id}." + "Timeout exceeded when calling GET /ticket_types/{ticket_type_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -319,21 +327,23 @@ export class TicketTypes { */ public async update( request: Intercom.UpdateTicketTypeRequest, - requestOptions?: TicketTypes.RequestOptions + requestOptions?: TicketTypes.RequestOptions, ): Promise { const { ticket_type_id: ticketTypeId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${encodeURIComponent(ticketTypeId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ticket_types/${encodeURIComponent(ticketTypeId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -370,7 +380,7 @@ export class TicketTypes { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling PUT /ticket_types/{ticket_type_id}." + "Timeout exceeded when calling PUT /ticket_types/{ticket_type_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -383,7 +393,8 @@ export class TicketTypes { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/ticketTypes/resources/attributes/client/Client.ts b/src/api/resources/ticketTypes/resources/attributes/client/Client.ts index 86190542..0b206966 100644 --- a/src/api/resources/ticketTypes/resources/attributes/client/Client.ts +++ b/src/api/resources/ticketTypes/resources/attributes/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../../../errors/index"; export declare namespace Attributes { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Attributes { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -89,21 +91,23 @@ export class Attributes { */ public async create( request: Intercom.ticketTypes.CreateTicketTypeAttributeRequest, - requestOptions?: Attributes.RequestOptions + requestOptions?: Attributes.RequestOptions, ): Promise { const { ticket_type_id: ticketTypeId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${encodeURIComponent(ticketTypeId)}/attributes` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ticket_types/${encodeURIComponent(ticketTypeId)}/attributes`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -140,7 +144,7 @@ export class Attributes { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling POST /ticket_types/{ticket_type_id}/attributes." + "Timeout exceeded when calling POST /ticket_types/{ticket_type_id}/attributes.", ); case "unknown": throw new errors.IntercomError({ @@ -166,21 +170,23 @@ export class Attributes { */ public async update( request: Intercom.ticketTypes.UpdateTicketTypeAttributeRequest, - requestOptions?: Attributes.RequestOptions + requestOptions?: Attributes.RequestOptions, ): Promise { const { ticket_type_id: ticketTypeId, attribute_id: attributeId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${encodeURIComponent(ticketTypeId)}/attributes/${encodeURIComponent(attributeId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `ticket_types/${encodeURIComponent(ticketTypeId)}/attributes/${encodeURIComponent(attributeId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -217,7 +223,7 @@ export class Attributes { }); case "timeout": throw new errors.IntercomTimeoutError( - "Timeout exceeded when calling PUT /ticket_types/{ticket_type_id}/attributes/{attribute_id}." + "Timeout exceeded when calling PUT /ticket_types/{ticket_type_id}/attributes/{attribute_id}.", ); case "unknown": throw new errors.IntercomError({ @@ -230,7 +236,8 @@ export class Attributes { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/tickets/client/Client.ts b/src/api/resources/tickets/client/Client.ts index b4720b29..6942cd19 100644 --- a/src/api/resources/tickets/client/Client.ts +++ b/src/api/resources/tickets/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Tickets { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Tickets { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -135,21 +137,23 @@ export class Tickets { */ public async reply( request: Intercom.ReplyToTicketRequest, - requestOptions?: Tickets.RequestOptions + requestOptions?: Tickets.RequestOptions, ): Promise { const { ticket_id: ticketId, body: _body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${encodeURIComponent(ticketId)}/reply` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `tickets/${encodeURIComponent(ticketId)}/reply`, ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -219,20 +223,22 @@ export class Tickets { */ public async create( request: Intercom.CreateTicketRequest, - requestOptions?: Tickets.RequestOptions + requestOptions?: Tickets.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "tickets" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "tickets", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -291,21 +297,23 @@ export class Tickets { */ public async get( request: Intercom.FindTicketRequest, - requestOptions?: Tickets.RequestOptions + requestOptions?: Tickets.RequestOptions, ): Promise { const { ticket_id: ticketId } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${encodeURIComponent(ticketId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `tickets/${encodeURIComponent(ticketId)}`, ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -403,21 +411,23 @@ export class Tickets { */ public async update( request: Intercom.UpdateTicketRequest, - requestOptions?: Tickets.RequestOptions + requestOptions?: Tickets.RequestOptions, ): Promise { const { ticket_id: ticketId, ..._body } = request; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${encodeURIComponent(ticketId)}` + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + `tickets/${encodeURIComponent(ticketId)}`, ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -546,22 +556,23 @@ export class Tickets { */ public async search( request: Intercom.SearchRequest, - requestOptions?: Tickets.RequestOptions + requestOptions?: Tickets.RequestOptions, ): Promise> { const list = async (request: Intercom.SearchRequest): Promise => { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "tickets/search" + "tickets/search", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -603,7 +614,7 @@ export class Tickets { getItems: (response) => response?.tickets ?? [], loadPage: (response) => { return list( - core.setObjectProperty(request, "pagination.starting_after", response?.pages?.next?.starting_after) + core.setObjectProperty(request, "pagination.starting_after", response?.pages?.next?.starting_after), ); }, }); @@ -613,7 +624,8 @@ export class Tickets { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/api/resources/visitors/client/Client.ts b/src/api/resources/visitors/client/Client.ts index dc9e4d33..29d31f04 100644 --- a/src/api/resources/visitors/client/Client.ts +++ b/src/api/resources/visitors/client/Client.ts @@ -9,8 +9,10 @@ import urlJoin from "url-join"; import * as errors from "../../../../errors/index"; export declare namespace Visitors { - interface Options { + export interface Options { environment?: core.Supplier; + /** Specify a custom URL to connect the client to. */ + baseUrl?: core.Supplier; token?: core.Supplier; /** Override the Intercom-Version header */ version?: @@ -35,7 +37,7 @@ export declare namespace Visitors { fetcher?: core.FetchFunction; } - interface RequestOptions { + export interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ @@ -89,23 +91,25 @@ export class Visitors { */ public async find( request: Intercom.FindVisitorRequest, - requestOptions?: Visitors.RequestOptions + requestOptions?: Visitors.RequestOptions, ): Promise { const { user_id: userId } = request; - const _queryParams: Record = {}; + const _queryParams: Record = {}; _queryParams["user_id"] = userId; const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "visitors" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "visitors", ), method: "GET", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -178,20 +182,22 @@ export class Visitors { */ public async update( request: Intercom.UpdateVisitorRequest, - requestOptions?: Visitors.RequestOptions + requestOptions?: Visitors.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "visitors" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "visitors", ), method: "PUT", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -263,20 +269,22 @@ export class Visitors { */ public async mergeToContact( request: Intercom.MergeVisitorToContactRequest, - requestOptions?: Visitors.RequestOptions + requestOptions?: Visitors.RequestOptions, ): Promise { const _response = await (this._options.fetcher ?? core.fetcher)({ url: urlJoin( - (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - "visitors/convert" + (await core.Supplier.get(this._options.baseUrl)) ?? + (await core.Supplier.get(this._options.environment)) ?? + environments.IntercomEnvironment.UsProduction, + "visitors/convert", ), method: "POST", headers: { Authorization: await this._getAuthorizationHeader(), "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "v6.1.1", - "User-Agent": "intercom-client/v6.1.1", + "X-Fern-SDK-Version": "6.2.0", + "User-Agent": "intercom-client/6.2.0", "Intercom-Version": requestOptions?.version ?? this._options?.version ?? "2.11", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, @@ -324,7 +332,8 @@ export class Visitors { const bearer = (await core.Supplier.get(this._options.token)) ?? process?.env["INTERCOM_API_KEY"]; if (bearer == null) { throw new errors.IntercomError({ - message: "Please specify INTERCOM_API_KEY when instantiating the client.", + message: + "Please specify a bearer by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", }); } diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index b8f23717..f3ee18ee 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -1,3 +1,4 @@ +import { toJson } from "../json"; import { APIResponse } from "./APIResponse"; import { createRequestUrl } from "./createRequestUrl"; import { getFetchFn } from "./getFetchFn"; @@ -14,7 +15,7 @@ export declare namespace Fetcher { method: string; contentType?: string; headers?: Record; - queryParameters?: Record; + queryParameters?: Record; body?: unknown; timeoutMs?: number; maxRetries?: number; @@ -64,7 +65,7 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise= 200 && response.status < 400) { return { @@ -134,7 +135,7 @@ export async function fetcherImpl(args: Fetcher.Args): Promise + queryParameters?: Record, ): string { return Object.keys(queryParameters ?? {}).length > 0 ? `${baseUrl}?${qs.stringify(queryParameters, { arrayFormat: "repeat" })}` diff --git a/src/core/fetcher/getRequestBody.ts b/src/core/fetcher/getRequestBody.ts index 1138414b..fce5589c 100644 --- a/src/core/fetcher/getRequestBody.ts +++ b/src/core/fetcher/getRequestBody.ts @@ -1,3 +1,5 @@ +import { toJson } from "../json"; + export declare namespace GetRequestBody { interface Args { body: unknown; @@ -7,7 +9,7 @@ export declare namespace GetRequestBody { export async function getRequestBody({ body, type }: GetRequestBody.Args): Promise { if (type.includes("json")) { - return JSON.stringify(body); + return toJson(body); } else { return body as BodyInit; } diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts index 8fb4bace..1af42bb9 100644 --- a/src/core/fetcher/makeRequest.ts +++ b/src/core/fetcher/makeRequest.ts @@ -9,7 +9,7 @@ export const makeRequest = async ( timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, - duplex?: "half" + duplex?: "half", ): Promise => { const signals: AbortSignal[] = []; diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts index 8d5af9d5..add3cce0 100644 --- a/src/core/fetcher/requestWithRetries.ts +++ b/src/core/fetcher/requestWithRetries.ts @@ -11,12 +11,12 @@ function addJitter(delay: number): number { export async function requestWithRetries( requestFn: () => Promise, - maxRetries: number = DEFAULT_MAX_RETRIES + maxRetries: number = DEFAULT_MAX_RETRIES, ): Promise { let response: Response = await requestFn(); for (let i = 0; i < maxRetries; ++i) { - if ([408, 409, 429].includes(response.status) || response.status >= 500) { + if ([408, 429].includes(response.status) || response.status >= 500) { // Calculate base delay using exponential backoff (in milliseconds) const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY); diff --git a/src/core/fetcher/signals.ts b/src/core/fetcher/signals.ts index 6c124ff7..a8d32a2e 100644 --- a/src/core/fetcher/signals.ts +++ b/src/core/fetcher/signals.ts @@ -15,7 +15,7 @@ export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abor export function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal { // Allowing signals to be passed either as array // of signals or as multiple arguments. - const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args); + const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args) as AbortSignal[]; const controller = new AbortController(); diff --git a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts index 4d7b7d52..6f1a82e9 100644 --- a/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts +++ b/src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.ts @@ -1,4 +1,5 @@ import type { Writable } from "readable-stream"; + import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; export class Node18UniversalStreamWrapper @@ -38,7 +39,7 @@ export class Node18UniversalStreamWrapper | Writable | WritableStream + dest: Node18UniversalStreamWrapper | Writable | WritableStream, ): Node18UniversalStreamWrapper | Writable | WritableStream { this.on("data", async (chunk) => { if (dest instanceof Node18UniversalStreamWrapper) { @@ -79,7 +80,7 @@ export class Node18UniversalStreamWrapper | Writable | WritableStream + dest: Node18UniversalStreamWrapper | Writable | WritableStream, ): Node18UniversalStreamWrapper | Writable | WritableStream { return this.pipe(dest); } diff --git a/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts index ba5f7276..23c01a1a 100644 --- a/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts +++ b/src/core/fetcher/stream-wrappers/NodePre18StreamWrapper.ts @@ -1,4 +1,5 @@ import type { Readable, Writable } from "readable-stream"; + import { EventCallback, StreamWrapper } from "./chooseStreamWrapper"; export class NodePre18StreamWrapper implements StreamWrapper { diff --git a/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts index 263af009..091e2a7f 100644 --- a/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts +++ b/src/core/fetcher/stream-wrappers/UndiciStreamWrapper.ts @@ -38,7 +38,7 @@ export class UndiciStreamWrapper | WritableStream + dest: UndiciStreamWrapper | WritableStream, ): UndiciStreamWrapper | WritableStream { this.on("data", (chunk) => { if (dest instanceof UndiciStreamWrapper) { @@ -73,7 +73,7 @@ export class UndiciStreamWrapper | WritableStream + dest: UndiciStreamWrapper | WritableStream, ): UndiciStreamWrapper | WritableStream { return this.pipe(dest); } diff --git a/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts index 2abd6b2b..8c7492fc 100644 --- a/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts +++ b/src/core/fetcher/stream-wrappers/chooseStreamWrapper.ts @@ -1,4 +1,5 @@ import type { Readable } from "readable-stream"; + import { RUNTIME } from "../../runtime"; export type EventCallback = (data?: any) => void; @@ -23,7 +24,7 @@ export interface StreamWrapper { export async function chooseStreamWrapper(responseBody: any): Promise>> { if (RUNTIME.type === "node" && RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { return new (await import("./Node18UniversalStreamWrapper")).Node18UniversalStreamWrapper( - responseBody as ReadableStream + responseBody as ReadableStream, ); } else if (RUNTIME.type !== "node" && typeof fetch === "function") { return new (await import("./UndiciStreamWrapper")).UndiciStreamWrapper(responseBody as ReadableStream); diff --git a/src/core/json.ts b/src/core/json.ts new file mode 100644 index 00000000..c052f324 --- /dev/null +++ b/src/core/json.ts @@ -0,0 +1,27 @@ +/** + * Serialize a value to JSON + * @param value A JavaScript value, usually an object or array, to be converted. + * @param replacer A function that transforms the results. + * @param space Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read. + * @returns JSON string + */ +export const toJson = ( + value: unknown, + replacer?: (this: unknown, key: string, value: unknown) => unknown, + space?: string | number, +): string => { + return JSON.stringify(value, replacer, space); +}; + +/** + * Parse JSON string to object, array, or other type + * @param text A valid JSON string. + * @param reviver A function that transforms the results. This function is called for each member of the object. If a member contains nested objects, the nested objects are transformed before the parent object is. + * @returns Parsed object, array, or other type + */ +export function fromJson( + text: string, + reviver?: (this: unknown, key: string, value: unknown) => unknown, +): T { + return JSON.parse(text, reviver); +} diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index 4d0687e8..a9750175 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -8,58 +8,9 @@ interface BunGlobal { version: string; } -declare const Deno: DenoGlobal; -declare const Bun: BunGlobal; - -/** - * A constant that indicates whether the environment the code is running is a Web Browser. - */ -const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; - -/** - * A constant that indicates whether the environment the code is running is a Web Worker. - */ -const isWebWorker = - typeof self === "object" && - // @ts-ignore - typeof self?.importScripts === "function" && - (self.constructor?.name === "DedicatedWorkerGlobalScope" || - self.constructor?.name === "ServiceWorkerGlobalScope" || - self.constructor?.name === "SharedWorkerGlobalScope"); - -/** - * A constant that indicates whether the environment the code is running is Deno. - */ -const isDeno = - typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; - -/** - * A constant that indicates whether the environment the code is running is Bun.sh. - */ -const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; - -/** - * A constant that indicates whether the environment the code is running is Node.JS. - */ -const isNode = - typeof process !== "undefined" && - Boolean(process.version) && - Boolean(process.versions?.node) && - // Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions - !isDeno && - !isBun; - -/** - * A constant that indicates whether the environment the code is running is in React-Native. - * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js - */ -const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; - -/** - * A constant that indicates whether the environment the code is running is Cloudflare. - * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent - */ -const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers"; +declare const Deno: DenoGlobal | undefined; +declare const Bun: BunGlobal | undefined; +declare const EdgeRuntime: string | undefined; /** * A constant that indicates which environment and version the SDK is running in. @@ -67,12 +18,16 @@ const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator? export const RUNTIME: Runtime = evaluateRuntime(); export interface Runtime { - type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd"; + type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime"; version?: string; parsedVersion?: number; } function evaluateRuntime(): Runtime { + /** + * A constant that indicates whether the environment the code is running is a Web Browser. + */ + const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined"; if (isBrowser) { return { type: "browser", @@ -80,18 +35,50 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is Cloudflare. + * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent + */ + const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers"; if (isCloudflare) { return { type: "workerd", }; } + /** + * A constant that indicates whether the environment the code is running is Edge Runtime. + * https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime + */ + const isEdgeRuntime = typeof EdgeRuntime === "string"; + if (isEdgeRuntime) { + return { + type: "edge-runtime", + }; + } + + /** + * A constant that indicates whether the environment the code is running is a Web Worker. + */ + const isWebWorker = + typeof self === "object" && + // @ts-ignore + typeof self?.importScripts === "function" && + (self.constructor?.name === "DedicatedWorkerGlobalScope" || + self.constructor?.name === "ServiceWorkerGlobalScope" || + self.constructor?.name === "SharedWorkerGlobalScope"); if (isWebWorker) { return { type: "web-worker", }; } + /** + * A constant that indicates whether the environment the code is running is Deno. + * FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions + */ + const isDeno = + typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined"; if (isDeno) { return { type: "deno", @@ -99,6 +86,10 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is Bun.sh. + */ + const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined"; if (isBun) { return { type: "bun", @@ -106,6 +97,15 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is Node.JS. + */ + const isNode = + typeof process !== "undefined" && + "version" in process && + !!process.version && + "versions" in process && + !!process.versions?.node; if (isNode) { return { type: "node", @@ -114,6 +114,11 @@ function evaluateRuntime(): Runtime { }; } + /** + * A constant that indicates whether the environment the code is running is in React-Native. + * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js + */ + const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative"; if (isReactNative) { return { type: "react-native", diff --git a/src/errors/IntercomError.ts b/src/errors/IntercomError.ts index 898a54a6..add6ed73 100644 --- a/src/errors/IntercomError.ts +++ b/src/errors/IntercomError.ts @@ -2,6 +2,8 @@ * This file was auto-generated by Fern from our API Definition. */ +import { toJson } from "../core/json"; + export class IntercomError extends Error { readonly statusCode?: number; readonly body?: unknown; @@ -38,7 +40,7 @@ function buildMessage({ } if (body != null) { - lines.push(`Body: ${JSON.stringify(body, undefined, 2)}`); + lines.push(`Body: ${toJson(body, undefined, 2)}`); } return lines.join("\n"); diff --git a/src/version.ts b/src/version.ts index 9e9f5ed5..35d67468 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "v6.1.1"; +export const SDK_VERSION = "6.2.0"; diff --git a/tests/unit/auth/BasicAuth.test.ts b/tests/unit/auth/BasicAuth.test.ts index fc35704e..79ef9799 100644 --- a/tests/unit/auth/BasicAuth.test.ts +++ b/tests/unit/auth/BasicAuth.test.ts @@ -7,7 +7,7 @@ describe("BasicAuth", () => { BasicAuth.toAuthorizationHeader({ username: "username", password: "password", - }) + }), ).toBe("Basic dXNlcm5hbWU6cGFzc3dvcmQ="); }); }); diff --git a/tests/unit/fetcher/Fetcher.test.ts b/tests/unit/fetcher/Fetcher.test.ts index ff804217..a32945e9 100644 --- a/tests/unit/fetcher/Fetcher.test.ts +++ b/tests/unit/fetcher/Fetcher.test.ts @@ -1,7 +1,8 @@ import fs from "fs"; -import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; import { join } from "path"; +import { Fetcher, fetcherImpl } from "../../../src/core/fetcher/Fetcher"; + describe("Test fetcherImpl", () => { it("should handle successful request", async () => { const mockArgs: Fetcher.Args = { @@ -32,7 +33,7 @@ describe("Test fetcherImpl", () => { method: "POST", headers: expect.objectContaining({ "X-Test": "x-test-header" }), body: JSON.stringify({ data: "test" }), - }) + }), ); }); @@ -63,7 +64,7 @@ describe("Test fetcherImpl", () => { method: "POST", headers: expect.objectContaining({ "X-Test": "x-test-header" }), body: expect.any(fs.ReadStream), - }) + }), ); expect(result.ok).toBe(true); if (result.ok) { diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts index f2cd24b6..486e1e61 100644 --- a/tests/unit/fetcher/createRequestUrl.test.ts +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -22,7 +22,7 @@ describe("Test createRequestUrl", () => { const baseUrl = "https://api.example.com"; const queryParams = { filter: { name: "John", age: 30 } }; expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30" + "https://api.example.com?filter%5Bname%5D=John&filter%5Bage%5D=30", ); }); @@ -34,7 +34,7 @@ describe("Test createRequestUrl", () => { object: { key: "value" }, }; expect(createRequestUrl(baseUrl, queryParams)).toBe( - "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value" + "https://api.example.com?simple=value&array=x&array=y&object%5Bkey%5D=value", ); }); diff --git a/tests/unit/fetcher/makeRequest.test.ts b/tests/unit/fetcher/makeRequest.test.ts index be94ab45..43ed9d11 100644 --- a/tests/unit/fetcher/makeRequest.test.ts +++ b/tests/unit/fetcher/makeRequest.test.ts @@ -1,4 +1,3 @@ -import { RUNTIME } from "../../../src/core/runtime"; import { makeRequest } from "../../../src/core/fetcher/makeRequest"; describe("Test makeRequest", () => { @@ -27,7 +26,7 @@ describe("Test makeRequest", () => { headers: mockHeaders, body: mockBody, credentials: undefined, - }) + }), ); expect(calledOptions.signal).toBeDefined(); expect(calledOptions.signal).toBeInstanceOf(AbortSignal); @@ -46,7 +45,7 @@ describe("Test makeRequest", () => { headers: mockHeaders, body: undefined, credentials: undefined, - }) + }), ); expect(calledOptions.signal).toBeDefined(); expect(calledOptions.signal).toBeInstanceOf(AbortSignal); diff --git a/tests/unit/fetcher/requestWithRetries.test.ts b/tests/unit/fetcher/requestWithRetries.test.ts index 6f77f093..3cdaa40a 100644 --- a/tests/unit/fetcher/requestWithRetries.test.ts +++ b/tests/unit/fetcher/requestWithRetries.test.ts @@ -1,4 +1,3 @@ -import { RUNTIME } from "../../../src/core/runtime"; import { requestWithRetries } from "../../../src/core/fetcher/requestWithRetries"; describe("requestWithRetries", () => { @@ -23,12 +22,12 @@ describe("requestWithRetries", () => { }); it("should retry on retryable status codes", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); - const retryableStatuses = [408, 409, 429, 500, 502]; + const retryableStatuses = [408, 429, 500, 502]; let callCount = 0; mockFetch.mockImplementation(async () => { @@ -47,7 +46,7 @@ describe("requestWithRetries", () => { }); it("should respect maxRetries limit", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -64,7 +63,7 @@ describe("requestWithRetries", () => { }); it("should not retry on success status codes", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -86,7 +85,7 @@ describe("requestWithRetries", () => { }); it("should apply correct exponential backoff with jitter", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); @@ -110,7 +109,7 @@ describe("requestWithRetries", () => { }); it("should handle concurrent retries independently", async () => { - setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback) => { + setTimeoutSpy = jest.spyOn(global, "setTimeout").mockImplementation((callback: (args: void) => void) => { process.nextTick(callback); return null as any; }); diff --git a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts index 1dc9be0c..172c1c26 100644 --- a/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts +++ b/tests/unit/fetcher/stream-wrappers/Node18UniversalStreamWrapper.test.ts @@ -159,7 +159,7 @@ describe("Node18UniversalStreamWrapper", () => { expect(data).toEqual({ test: "test" }); }); - it("should allow use with async iteratable stream", async () => { + it("should allow use with async iterable stream", async () => { const rawStream = new ReadableStream({ start(controller) { controller.enqueue(new TextEncoder().encode("test")); diff --git a/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts index 0c99d3b2..19c26668 100644 --- a/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts +++ b/tests/unit/fetcher/stream-wrappers/NodePre18StreamWrapper.test.ts @@ -111,7 +111,7 @@ describe("NodePre18StreamWrapper", () => { expect(data).toEqual({ test: "test" }); }); - it("should allow use with async iteratable stream", async () => { + it("should allow use with async iterable stream", async () => { const rawStream = (await import("readable-stream")).Readable.from(["test", "test"]); let data = ""; const stream = new NodePre18StreamWrapper(rawStream); diff --git a/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts index 1d171ce6..0ea14835 100644 --- a/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts +++ b/tests/unit/fetcher/stream-wrappers/UndiciStreamWrapper.test.ts @@ -134,7 +134,7 @@ describe("UndiciStreamWrapper", () => { expect(data).toEqual({ test: "test" }); }); - it("should allow use with async iteratable stream", async () => { + it("should allow use with async iterable stream", async () => { const rawStream = new ReadableStream({ start(controller) { controller.enqueue(new TextEncoder().encode("test")); diff --git a/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts index 17cf37a2..8004e9ab 100644 --- a/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts +++ b/tests/unit/fetcher/stream-wrappers/chooseStreamWrapper.test.ts @@ -1,8 +1,8 @@ import { RUNTIME } from "../../../../src/core/runtime"; -import { chooseStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; import { Node18UniversalStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper"; import { NodePre18StreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/NodePre18StreamWrapper"; import { UndiciStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/UndiciStreamWrapper"; +import { chooseStreamWrapper } from "../../../../src/core/fetcher/stream-wrappers/chooseStreamWrapper"; describe("chooseStreamWrapper", () => { beforeEach(() => { diff --git a/tests/unit/fetcher/stream-wrappers/webpack.test.ts b/tests/unit/fetcher/stream-wrappers/webpack.test.ts index 557db6dc..63fa0a78 100644 --- a/tests/unit/fetcher/stream-wrappers/webpack.test.ts +++ b/tests/unit/fetcher/stream-wrappers/webpack.test.ts @@ -17,7 +17,11 @@ describe("test env compatibility", () => { ], }, resolve: { - extensions: [".tsx", ".ts", ".js"], + extensions: [".tsx", ".ts", ".jsx", ".js"], + extensionAlias: { + ".js": [".ts", ".js"], + ".jsx": [".tsx", ".jsx"], + }, }, }, (err, stats) => { @@ -31,8 +35,8 @@ describe("test env compatibility", () => { } catch (error) { reject(error); } - } + }, ); }); - }, 60_000); + }, 90_000); }); diff --git a/tsconfig.json b/tsconfig.json index 538c94fe..1ec87dd7 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,14 +3,14 @@ "extendedDiagnostics": true, "strict": true, "target": "ES6", - "module": "CommonJS", "moduleResolution": "node", "esModuleInterop": true, "skipLibCheck": true, "declaration": true, "outDir": "dist", "rootDir": "src", - "baseUrl": "src" + "baseUrl": "src", + "module": "CommonJS" }, "include": ["src"], "exclude": [] diff --git a/yarn.lock b/yarn.lock index 970f6bab..eb8d8c8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -625,10 +625,10 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@29.5.5": - version "29.5.5" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.5.tgz#727204e06228fe24373df9bae76b90f3e8236a2a" - integrity sha512-ebylz2hnsWR9mYvmBFbXJXr+33UPc4+ZdxyDXh5w0FlPBTfCVN3wPL+kuOiQt3xvrK419v7XWeAs+AeOksafXg== +"@types/jest@^29.5.14": + version "29.5.14" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.14.tgz#2b910912fa1d6856cadcd0c1f95af7df1d6049e5" + integrity sha512-ZN+4sdnLUbo8EVvVc2ao0GFW6oVrQRPn4K2lglySj7APvSrgzxHiNNK99us4WDMi57xxA2yggblIAMNhXOotLQ== dependencies: expect "^29.0.0" pretty-format "^29.0.0" @@ -647,10 +647,10 @@ resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA== -"@types/node-fetch@2.6.9": - version "2.6.9" - resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.9.tgz#15f529d247f1ede1824f7e7acdaa192d5f28071e" - integrity sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA== +"@types/node-fetch@^2.6.12": + version "2.6.12" + resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.6.12.tgz#8ab5c3ef8330f13100a7479e2cd56d3386830a03" + integrity sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA== dependencies: "@types/node" "*" form-data "^4.0.0" @@ -662,17 +662,19 @@ dependencies: undici-types "~6.20.0" -"@types/node@17.0.33": - version "17.0.33" - resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" - integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ== +"@types/node@^18.19.70": + version "18.19.80" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.80.tgz#6d6008e8920dddcd23f9dd33da24684ef57d487c" + integrity sha512-kEWeMwMeIvxYkeg1gTc01awpwLbfMRZXdIhwRcakd/KlK53jmRC26LqcbIt7fnAQTu5GzlnWmzA3H6+l1u6xxQ== + dependencies: + undici-types "~5.26.4" -"@types/qs@6.9.8": - version "6.9.8" - resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.8.tgz#f2a7de3c107b89b441e071d5472e6b726b4adf45" - integrity sha512-u95svzDlTysU5xecFNTgfFG5RUWu1A9P0VzgpcIiGZA9iraHOdSzcxMxQ55DyeRaGCSxQi7LxXDI4rzq/MYfdg== +"@types/qs@^6.9.17": + version "6.9.18" + resolved "https://registry.yarnpkg.com/@types/qs/-/qs-6.9.18.tgz#877292caa91f7c1b213032b34626505b746624c2" + integrity sha512-kK7dgTYDyGqS+e2Q4aK9X3D7q234CIZ1Bv0q/7Z5IwRDoADNU81xXJK/YVyLbLTZCoIwUoDoffFeF+p/eIklAA== -"@types/readable-stream@^4.0.15": +"@types/readable-stream@^4.0.18": version "4.0.18" resolved "https://registry.yarnpkg.com/@types/readable-stream/-/readable-stream-4.0.18.tgz#5d8d15d26c776500ce573cae580787d149823bfc" integrity sha512-21jK/1j+Wg+7jVw1xnSwy/2Q1VgVjWuFssbYGTREPUBeZ+rqVFl2udq0IkxzPC0ZhOzVceUbyIACFZKLqKEBlA== @@ -940,6 +942,11 @@ argparse@^1.0.7: dependencies: sprintf-js "~1.0.2" +async@^3.2.3: + version "3.2.6" + resolved "https://registry.yarnpkg.com/async/-/async-3.2.6.tgz#1b0728e14929d51b85b449b7f06e27c1145e38ce" + integrity sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA== + asynckit@^0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" @@ -1026,6 +1033,13 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +brace-expansion@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.1.tgz#1edc459e0f0c548486ecf9fc99f2221364b9a0ae" + integrity sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA== + dependencies: + balanced-match "^1.0.0" + braces@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" @@ -1043,7 +1057,7 @@ browserslist@^4.24.0: node-releases "^2.0.19" update-browserslist-db "^1.1.1" -bs-logger@0.x: +bs-logger@^0.2.6: version "0.2.6" resolved "https://registry.yarnpkg.com/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== @@ -1106,7 +1120,7 @@ caniuse-lite@^1.0.30001688: resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001706.tgz#902c3f896f4b2968031c3a546ab2ef8b465a2c8f" integrity sha512-3ZczoTApMAZwPKYWmwVbQMFpXBDds3/0VciVoUwPUbldlYyVLmRVuRs/PcUZtHpbLRpzzDvrvnFuREsGt6lUug== -chalk@^4.0.0, chalk@^4.1.0: +chalk@^4.0.0, chalk@^4.0.2, chalk@^4.1.0: version "4.1.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-4.1.2.tgz#aac4e2b7734a740867aeb16bf02aad556a1e7a01" integrity sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA== @@ -1288,6 +1302,13 @@ dunder-proto@^1.0.1: es-errors "^1.3.0" gopd "^1.2.0" +ejs@^3.1.10: + version "3.1.10" + resolved "https://registry.yarnpkg.com/ejs/-/ejs-3.1.10.tgz#69ab8358b14e896f80cc39e62087b88500c3ac3b" + integrity sha512-UeJmFfOrAQS8OJWPZ4qtgHyWExa088/MtK5UEyoJGFH67cDEXkZSviOiKRCZ4Xij0zxI3JECgYs3oKx+AizQBA== + dependencies: + jake "^10.8.5" + electron-to-chromium@^1.5.73: version "1.5.122" resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.5.122.tgz#4fabd37b30b71dc041f6c6c4bab309b3f8348fcb" @@ -1474,6 +1495,13 @@ fb-watchman@^2.0.0: dependencies: bser "2.1.1" +filelist@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/filelist/-/filelist-1.0.4.tgz#f78978a1e944775ff9e62e744424f215e58352b5" + integrity sha512-w1cEuf3S+DrLCQL7ET6kz+gmlJdbq9J7yXCSjK/OZCPA+qEN1WyF4ZAf0YYJa4/shHJra2t/d/r8SV4Ji+x+8Q== + dependencies: + minimatch "^5.0.1" + fill-range@^7.1.1: version "7.1.1" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.1.1.tgz#44265d3cac07e3ea7dc247516380643754a05292" @@ -1786,6 +1814,16 @@ istanbul-reports@^3.1.3: html-escaper "^2.0.0" istanbul-lib-report "^3.0.0" +jake@^10.8.5: + version "10.9.2" + resolved "https://registry.yarnpkg.com/jake/-/jake-10.9.2.tgz#6ae487e6a69afec3a5e167628996b59f35ae2b7f" + integrity sha512-2P4SQ0HrLQ+fw6llpLnOaGAvN2Zu6778SJMrCUwns4fOoG9ayrTiZk3VV8sCPkVZF8ab0zksVpS8FDY5pRCNBA== + dependencies: + async "^3.2.3" + chalk "^4.0.2" + filelist "^1.0.4" + minimatch "^3.1.2" + jest-changed-files@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" @@ -1894,7 +1932,7 @@ jest-each@^29.7.0: jest-util "^29.7.0" pretty-format "^29.7.0" -jest-environment-jsdom@29.7.0: +jest-environment-jsdom@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== @@ -2157,7 +2195,7 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@29.7.0: +jest@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== @@ -2167,10 +2205,10 @@ jest@29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" -js-base64@3.7.2: - version "3.7.2" - resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.2.tgz#816d11d81a8aff241603d19ce5761e13e41d7745" - integrity sha512-NnRs6dsyqUXejqk/yv2aiXlAvOs56sLkX6nUdeaNezI5LFFLlsZjOThmwnrcwh5ZZRwZlCMnVAY3CvhIhoVEKQ== +js-base64@3.7.7: + version "3.7.7" + resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-3.7.7.tgz#e51b84bf78fbf5702b9541e2cb7bfcb893b43e79" + integrity sha512-7rCnleh0z2CkXhH67J8K1Ytz0b2Y+yxTPL+/KOJoa20hfnVQ/3/T6W/KflYI4bRHRagNeXeU2bkNGI3v1oS/lw== js-tokens@^4.0.0: version "4.0.0" @@ -2264,7 +2302,7 @@ locate-path@^5.0.0: dependencies: p-locate "^4.1.0" -lodash.memoize@4.x: +lodash.memoize@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" integrity sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag== @@ -2283,7 +2321,7 @@ make-dir@^4.0.0: dependencies: semver "^7.5.3" -make-error@1.x: +make-error@^1.3.6: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== @@ -2330,13 +2368,20 @@ mimic-fn@^2.1.0: resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b" integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg== -minimatch@^3.0.4, minimatch@^3.1.1: +minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== dependencies: brace-expansion "^1.1.7" +minimatch@^5.0.1: + version "5.1.6" + resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96" + integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g== + dependencies: + brace-expansion "^2.0.1" + ms@^2.1.3: version "2.1.3" resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2" @@ -2352,7 +2397,7 @@ neo-async@^2.6.2: resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -node-fetch@2.7.0: +node-fetch@^2.7.0: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -2490,10 +2535,10 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -prettier@2.7.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.7.1.tgz#e235806850d057f97bb08368a4f7d899f7760c64" - integrity sha512-ujppO+MkdPqoVINuDFDRLClm7D78qbDt0/NR+wp5FqEZOoTNAjPHWj17QRhu7geIHJfcNhRk1XVQmF8Bp3ye+g== +prettier@^3.4.2: + version "3.5.3" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.5.3.tgz#4fc2ce0d657e7a02e602549f053b239cb7dfe1b5" + integrity sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw== pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" @@ -2534,12 +2579,12 @@ pure-rand@^6.0.0: resolved "https://registry.yarnpkg.com/pure-rand/-/pure-rand-6.1.0.tgz#d173cf23258231976ccbdb05247c9787957604f2" integrity sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA== -qs@6.11.2: - version "6.11.2" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.2.tgz#64bea51f12c1f5da1bc01496f48ffcff7c69d7d9" - integrity sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA== +qs@^6.13.1: + version "6.14.0" + resolved "https://registry.yarnpkg.com/qs/-/qs-6.14.0.tgz#c63fa40680d2c5c941412a0e899c89af60c0a930" + integrity sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w== dependencies: - side-channel "^1.0.4" + side-channel "^1.1.0" querystringify@^2.1.1: version "2.2.0" @@ -2647,7 +2692,7 @@ semver@^6.3.0, semver@^6.3.1: resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.1.tgz#556d2ef8689146e46dcea4bfdd095f3434dffcb4" integrity sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA== -semver@^7.3.4, semver@^7.5.3, semver@^7.5.4: +semver@^7.3.4, semver@^7.5.3, semver@^7.5.4, semver@^7.7.1: version "7.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-7.7.1.tgz#abd5098d82b18c6c81f6074ff2647fd3e7220c9f" integrity sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA== @@ -2700,7 +2745,7 @@ side-channel-weakmap@^1.0.2: object-inspect "^1.13.3" side-channel-map "^1.0.1" -side-channel@^1.0.4: +side-channel@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.1.0.tgz#c3fcff9c4da932784873335ec9765fa94ff66bc9" integrity sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw== @@ -2903,21 +2948,22 @@ tr46@~0.0.3: resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" integrity sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw== -ts-jest@29.1.1: - version "29.1.1" - resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.1.1.tgz#f58fe62c63caf7bfcc5cc6472082f79180f0815b" - integrity sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA== +ts-jest@^29.1.1: + version "29.2.6" + resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-29.2.6.tgz#df53edf8b72fb89de032cfa310abf37582851d9a" + integrity sha512-yTNZVZqc8lSixm+QGVFcPe6+yj7+TWZwIesuOWvfcn4B9bz5x4NDzVCQQjOs7Hfouu36aEqfEbo9Qpo+gq8dDg== dependencies: - bs-logger "0.x" - fast-json-stable-stringify "2.x" + bs-logger "^0.2.6" + ejs "^3.1.10" + fast-json-stable-stringify "^2.1.0" jest-util "^29.0.0" json5 "^2.2.3" - lodash.memoize "4.x" - make-error "1.x" - semver "^7.5.3" - yargs-parser "^21.0.1" + lodash.memoize "^4.1.2" + make-error "^1.3.6" + semver "^7.7.1" + yargs-parser "^21.1.1" -ts-loader@^9.3.1: +ts-loader@^9.5.1: version "9.5.2" resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-9.5.2.tgz#1f3d7f4bb709b487aaa260e8f19b301635d08020" integrity sha512-Qo4piXvOTWcMGIgRiuFa6nHNm+54HbYaZCKqc9eeZCLRy3XqafQgwX2F7mofrbJG3g7EEb+lkiR+z2Lic2s3Zw== @@ -2938,10 +2984,15 @@ type-fest@^0.21.3: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" integrity sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w== -typescript@4.6.4: - version "4.6.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.6.4.tgz#caa78bbc3a59e6a5c510d35703f6a09877ce45e9" - integrity sha512-9ia/jWHIEbo49HfjrLGfKbZSuWo9iTMwXO+Ca3pRsSpbsMbc7/IU8NKdCZVRRBafVPGnoJeFL76ZOAA84I9fEg== +typescript@~5.7.2: + version "5.7.3" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e" + integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw== + +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== undici-types@~6.20.0: version "6.20.0" @@ -3020,7 +3071,7 @@ webpack-sources@^3.2.3: resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-3.2.3.tgz#2d4daab8451fd4b240cc27055ff6a0c2ccea0cde" integrity sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w== -webpack@^5.94.0: +webpack@^5.97.1: version "5.98.0" resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.98.0.tgz#44ae19a8f2ba97537978246072fb89d10d1fbd17" integrity sha512-UFynvx+gM44Gv9qFgj0acCQK2VE1CtdfwFdimkapco3hlPCJ/zeq73n2yVKimVbtm+TnApIugGhLJnkU6gjYXA== @@ -3131,7 +3182,7 @@ yallist@^3.0.2: resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== -yargs-parser@^21.0.1, yargs-parser@^21.1.1: +yargs-parser@^21.1.1: version "21.1.1" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-21.1.1.tgz#9096bceebf990d21bb31fa9516e0ede294a77d35" integrity sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==