diff --git a/.fern/metadata.json b/.fern/metadata.json index ef3f5299..e673210c 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,7 +1,7 @@ { - "cliVersion": "3.0.2", + "cliVersion": "5.65.3", "generatorName": "fernapi/fern-typescript-sdk", - "generatorVersion": "3.35.8", + "generatorVersion": "3.107.1", "generatorConfig": { "namespaceExport": "Intercom", "allowCustomFetcher": true, diff --git a/README.md b/README.md index 753ab107..80351b1c 100644 --- a/README.md +++ b/README.md @@ -1,30 +1,41 @@ # Intercom TypeScript Library -[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fintercom%2Fintercom-node) -[![npm shield](https://img.shields.io/npm/v/intercom-client)](https://www.npmjs.com/package/intercom-client) +[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Intercom%2FTypeScript) The Intercom TypeScript library provides convenient access to the Intercom APIs from TypeScript. -## Project Updates - -The TypeScript SDK has been updated to support latest API version (2.11). - -## Installation - -```sh -npm i -s intercom-client -``` +## Table of Contents + +- [Reference](#reference) +- [Usage](#usage) +- [Environments](#environments) +- [Request and Response Types](#request-and-response-types) +- [Exception Handling](#exception-handling) +- [Pagination](#pagination) +- [Advanced](#advanced) + - [Subpackage Exports](#subpackage-exports) + - [Additional Headers](#additional-headers) + - [Additional Query String Parameters](#additional-query-string-parameters) + - [Retries](#retries) + - [Timeouts](#timeouts) + - [Aborting Requests](#aborting-requests) + - [Access Raw Response Data](#access-raw-response-data) + - [Logging](#logging) + - [Custom Fetch](#custom-fetch) + - [Custom Fetcher](#custom-fetcher) + - [Runtime Compatibility](#runtime-compatibility) +- [Contributing](#contributing) ## Reference -A full reference for this library is available [here](https://github.com/intercom/intercom-node/blob/HEAD/./reference.md). +A full reference for this library is available [here](./reference.md). ## Usage Instantiate and use the client with the following: ```typescript -import { IntercomClient } from "intercom-client"; +import { IntercomClient } from "./src/Client"; const client = new IntercomClient({ token: "YOUR_TOKEN" }); await client.aiContent.createContentImportSource({ @@ -32,13 +43,25 @@ await client.aiContent.createContentImportSource({ }); ``` -## Request And Response Types +## Environments + +This SDK allows you to configure different environments for API requests. + +```typescript +import { IntercomClient, IntercomEnvironment } from "Intercom"; + +const client = new IntercomClient({ + environment: IntercomEnvironment.UsProduction, +}); +``` + +## Request and Response Types The SDK exports all request and response types as TypeScript interfaces. Simply import them with the following namespace: ```typescript -import { Intercom } from "intercom-client"; +import { Intercom } from "Intercom"; const request: Intercom.ConfigureAwayAdminRequest = { ... @@ -51,7 +74,7 @@ When the API returns a non-success status code (4xx or 5xx response), a subclass will be thrown. ```typescript -import { IntercomError } from "intercom-client"; +import { IntercomError } from "Intercom"; try { await client.aiContent.createContentImportSource(...); @@ -70,7 +93,7 @@ try { List endpoints are paginated. The SDK provides an iterator so that you can simply loop over the items: ```typescript -import { IntercomClient } from "intercom-client"; +import { IntercomClient } from "./src/Client"; const client = new IntercomClient({ token: "YOUR_TOKEN" }); const pageableResponse = await client.articles.list(); @@ -81,7 +104,7 @@ for await (const item of pageableResponse) { // Or you can manually iterate page-by-page let page = await client.articles.list(); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -90,11 +113,30 @@ const response = page.response; ## Advanced +### Subpackage Exports + +This SDK supports direct imports of subpackage clients, which allows JavaScript bundlers to tree-shake and include only the imported subpackage code. This results in much smaller bundle sizes. + +```typescript +import { AdminsClient } from 'Intercom/admins'; + +const client = new AdminsClient({...}); +``` + ### Additional Headers If you would like to send additional headers as part of the request, use the `headers` request option. ```typescript +import { IntercomClient } from "Intercom"; + +const client = new IntercomClient({ + ... + headers: { + 'X-Custom-Header': 'custom value' + } +}); + const response = await client.aiContent.createContentImportSource(..., { headers: { 'X-Custom-Header': 'custom value' @@ -120,11 +162,19 @@ The SDK is instrumented with automatic retries with exponential backoff. A reque 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 retryable when any of the following HTTP status codes is returned: +Which status codes are retried depends on the `retryStatusCodes` generator configuration: + +**`legacy`** (current default): retries on +- [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#server_error_responses) (All server errors, including 500) +**`recommended`**: retries on - [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) +- [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway) +- [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable) +- [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout) Use the `maxRetries` request option to configure this behavior. @@ -173,7 +223,7 @@ console.log(rawResponse.headers['X-My-Header']); The SDK supports logging. You can configure the logger by passing in a `logging` object to the client options. ```typescript -import { IntercomClient, logging } from "intercom-client"; +import { IntercomClient, logging } from "Intercom"; const client = new IntercomClient({ ... @@ -231,27 +281,33 @@ const logger: logging.ILogger = { -### Runtime Compatibility - - -The SDK works in the following runtimes: +### Custom Fetch +The SDK provides a low-level `fetch` method for making custom HTTP requests while still +benefiting from SDK-level configuration like authentication, retries, timeouts, and logging. +This is useful for calling API endpoints not yet supported in the SDK. +```typescript +const response = await client.fetch("/v1/custom/endpoint", { + method: "GET", +}, { + timeoutInSeconds: 30, + maxRetries: 3, + headers: { + "X-Custom-Header": "custom-value", + }, +}); -- Node.js 18+ -- Vercel -- Cloudflare Workers -- Deno v1.25+ -- Bun 1.0+ -- React Native +const data = await response.json(); +``` -### Customizing Fetch Client +### Custom Fetcher The SDK provides a way for you to customize the underlying HTTP client / Fetch function. If you're running in an unsupported environment, this provides a way for you to break glass and ensure the SDK works. ```typescript -import { IntercomClient } from "intercom-client"; +import { IntercomClient } from "Intercom"; const client = new IntercomClient({ ... @@ -259,6 +315,21 @@ const client = new IntercomClient({ }); ``` +### Runtime Compatibility + + +The SDK works in the following runtimes: + + + +- Node.js 18+ +- Vercel +- Cloudflare Workers +- Deno v1.25+ +- Bun 1.0+ +- React Native + + ## Contributing While we value open-source contributions to this SDK, this library is generated programmatically. @@ -267,4 +338,4 @@ otherwise they would be overwritten upon the next generated release. Feel free t 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! \ No newline at end of file +On the other hand, contributions to the README are always very welcome! diff --git a/package.json b/package.json index 4e22c764..1b76d437 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "intercom-client", - "version": "7.0.3", + "version": "7.1.0", "private": false, "repository": "github:intercom/intercom-node", "type": "commonjs", diff --git a/reference.md b/reference.md index 224ae271..35b3effc 100644 --- a/reference.md +++ b/reference.md @@ -943,7 +943,7 @@ await client.aiContent.deleteExternalPage({ ## Articles -
client.articles.list({ ...params }) -> core.Page +
client.articles.list({ ...params }) -> core.Page<Intercom.ArticleListItem, Intercom.ArticleList>
@@ -982,7 +982,7 @@ for await (const item of pageableResponse) { // Or you can manually iterate page-by-page let page = await client.articles.list(); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -1994,7 +1994,7 @@ await client.helpCenters.find({
-
client.helpCenters.list({ ...params }) -> core.Page +
client.helpCenters.list({ ...params }) -> core.Page<Intercom.HelpCenter, Intercom.HelpCenterList>
@@ -2029,7 +2029,7 @@ for await (const item of pageableResponse) { // Or you can manually iterate page-by-page let page = await client.helpCenters.list(); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -3070,7 +3070,7 @@ await client.companies.listAttachedSegments({
-
client.companies.list({ ...params }) -> core.Page +
client.companies.list({ ...params }) -> core.Page<Intercom.Company, Intercom.CompanyList>
@@ -3121,7 +3121,7 @@ let page = await client.companies.list({ order: "desc" }); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -3161,7 +3161,7 @@ const response = page.response;
-
client.companies.scroll({ ...params }) -> core.Page +
client.companies.scroll({ ...params }) -> core.Page<Intercom.Company, Intercom.CompanyScroll | undefined>
@@ -3214,7 +3214,7 @@ let page = await client.companies.scroll({ scroll_param: "scroll_param" }); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -3387,7 +3387,7 @@ await client.companies.detachContact({
## Contacts -
client.contacts.listAttachedCompanies({ ...params }) -> core.Page +
client.contacts.listAttachedCompanies({ ...params }) -> core.Page<Intercom.Company, Intercom.ContactAttachedCompanies>
@@ -3430,7 +3430,7 @@ let page = await client.contacts.listAttachedCompanies({ per_page: 1 }); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -4079,7 +4079,7 @@ await client.contacts.mergeLeadInUser({
-
client.contacts.search({ ...params }) -> core.Page +
client.contacts.search({ ...params }) -> core.Page<Intercom.Contact, Intercom.ContactList>
@@ -4236,7 +4236,7 @@ let page = await client.contacts.search({ } }); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -4276,7 +4276,7 @@ const response = page.response;
-
client.contacts.list({ ...params }) -> core.Page +
client.contacts.list({ ...params }) -> core.Page<Intercom.Contact, Intercom.ContactList>
@@ -4315,7 +4315,7 @@ for await (const item of pageableResponse) { // Or you can manually iterate page-by-page let page = await client.contacts.list(); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -4681,7 +4681,7 @@ await client.contacts.blockContact({
## Notes -
client.notes.list({ ...params }) -> core.Page +
client.notes.list({ ...params }) -> core.Page<Intercom.Note, Intercom.NoteList>
@@ -4720,7 +4720,7 @@ let page = await client.notes.list({ contact_id: "contact_id" }); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -5558,7 +5558,7 @@ await client.tags.untagTicket({
## Conversations -
client.conversations.list({ ...params }) -> core.Page +
client.conversations.list({ ...params }) -> core.Page<Intercom.Conversation, Intercom.ConversationList>
@@ -5605,7 +5605,7 @@ let page = await client.conversations.list({ starting_after: "starting_after" }); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -5948,7 +5948,7 @@ await client.conversations.deleteConversation({
-
client.conversations.search({ ...params }) -> core.Page +
client.conversations.search({ ...params }) -> core.Page<Intercom.Conversation, Intercom.ConversationList>
@@ -6105,7 +6105,7 @@ let page = await client.conversations.search({ } }); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -9334,7 +9334,7 @@ await client.tickets.deleteTicket({
-
client.tickets.search({ ...params }) -> core.Page<(Intercom.Ticket | undefined), Intercom.TicketList> +
client.tickets.search({ ...params }) -> core.Page<(Intercom.Ticket | undefined), Intercom.TicketList>
@@ -9461,7 +9461,7 @@ let page = await client.tickets.search({ } }); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -9714,7 +9714,7 @@ await client.visitors.mergeToContact({
## HelpCenters Collections -
client.helpCenters.collections.list({ ...params }) -> core.Page +
client.helpCenters.collections.list({ ...params }) -> core.Page<Intercom.Collection, Intercom.CollectionList>
@@ -9751,7 +9751,7 @@ for await (const item of pageableResponse) { // Or you can manually iterate page-by-page let page = await client.helpCenters.collections.list(); while (page.hasNextPage()) { - page = page.getNextPage(); + page = await page.getNextPage(); } // You can also access the underlying response @@ -14783,7 +14783,7 @@ await client.unstable.contacts.createContact({
-**request:** `Intercom.CreateContactRequestTwo` +**request:** `Intercom.CreateContactRequest`
@@ -16523,7 +16523,7 @@ await client.unstable.conversations.replyConversation({
-**request:** `Intercom.unstable.ReplyConversationRequest` +**request:** `Intercom.unstable.ReplyConversationBody`
@@ -17789,7 +17789,7 @@ await client.unstable.dataAttributes.updateDataAttribute({
-**request:** `Intercom.unstable.UpdateDataAttributeRequest` +**request:** `Intercom.unstable.UpdateDataAttributeBody`
@@ -17977,7 +17977,7 @@ await client.unstable.dataEvents.createDataEvent({
-**request:** `Intercom.CreateDataEventRequestTwo` +**request:** `Intercom.CreateDataEventRequest`
@@ -18707,7 +18707,7 @@ await client.unstable.messages.createMessage({
-**request:** `Intercom.CreateMessageRequest | undefined` +**request:** `Intercom.CreateMessageRequest`
@@ -21205,7 +21205,7 @@ await client.unstable.visitors.updateVisitor({
-**request:** `Intercom.UpdateVisitorRequestOne` +**request:** `Intercom.UpdateVisitorRequest`
@@ -21542,3 +21542,4 @@ await client.unstable.emails.retrieveEmail({
+ diff --git a/src/BaseClient.ts b/src/BaseClient.ts index 1c4b0442..c091dfb5 100644 --- a/src/BaseClient.ts +++ b/src/BaseClient.ts @@ -5,11 +5,16 @@ import { mergeHeaders } from "./core/headers.js"; import * as core from "./core/index.js"; import type * as environments from "./environments.js"; -export interface BaseClientOptions { +export type AuthOption = + | false + | core.AuthProvider["getAuthRequest"] + | core.AuthProvider + | BearerAuthProvider.AuthOptions; + +export type BaseClientOptions = { environment?: core.Supplier; /** Specify a custom URL to connect the client to. */ baseUrl?: core.Supplier; - token?: core.Supplier; /** Override the Intercom-Version header */ version?: | "1.0" @@ -44,7 +49,11 @@ export interface BaseClientOptions { fetcher?: core.FetchFunction; /** Configure logging for the client. */ logging?: core.logging.LogConfig | core.logging.Logger; -} + /** Default options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */ + stream?: { reconnectionEnabled?: boolean; maxReconnectionAttempts?: number }; + /** Override auth. Pass false to disable, a function returning auth headers, an AuthProvider, or auth options. */ + auth?: AuthOption; +} & BearerAuthProvider.AuthOptions; export interface BaseRequestOptions { /** The maximum time to wait for a response in seconds. */ @@ -55,8 +64,12 @@ export interface BaseRequestOptions { abortSignal?: AbortSignal; /** Additional query string parameters to include in the request. */ queryParams?: Record; + /** A dictionary containing additional parameters to spread into the request's body. */ + additionalBodyParameters?: Record; /** Additional headers to include in the request. */ headers?: Record | null | undefined>; + /** Options for SSE stream reconnection behavior. Has no effect on non-resumable endpoints. */ + stream?: { reconnectionEnabled?: boolean; maxReconnectionAttempts?: number }; /** Override the Intercom-Version header */ version?: | "1.0" @@ -82,22 +95,25 @@ export interface BaseRequestOptions { | "Unstable"; } -export type NormalizedClientOptions = T & { +export type NormalizedClientOptions = T & { logging: core.logging.Logger; authProvider?: core.AuthProvider; }; -export type NormalizedClientOptionsWithAuth = NormalizedClientOptions & { - authProvider: core.AuthProvider; -}; +export type NormalizedClientOptionsWithAuth = + NormalizedClientOptions & { + authProvider: core.AuthProvider; + }; -export function normalizeClientOptions(options: T): NormalizedClientOptions { +export function normalizeClientOptions( + options: T, +): NormalizedClientOptions { const headers = mergeHeaders( { "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "intercom-client", - "X-Fern-SDK-Version": "7.0.3", - "User-Agent": "intercom-client/7.0.3", + "X-Fern-SDK-Version": "7.1.0", + "User-Agent": "intercom-client/7.1.0", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version, "Intercom-Version": options?.version ?? "2.14", @@ -112,16 +128,33 @@ export function normalizeClientOptions(options: T): } as NormalizedClientOptions; } -export function normalizeClientOptionsWithAuth( +export function normalizeClientOptionsWithAuth( options: T, ): NormalizedClientOptionsWithAuth { const normalized = normalizeClientOptions(options) as NormalizedClientOptionsWithAuth; + + if (options.auth === false) { + normalized.authProvider = new core.NoOpAuthProvider(); + return normalized; + } + if (options.auth != null) { + if (typeof options.auth === "function") { + normalized.authProvider = { getAuthRequest: options.auth }; + return normalized; + } + if (core.isAuthProvider(options.auth)) { + normalized.authProvider = options.auth; + return normalized; + } + Object.assign(normalized, options.auth); + } + const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized); normalized.authProvider ??= new BearerAuthProvider(normalizedWithNoOpAuthProvider); return normalized; } -function withNoOpAuthProvider( +function withNoOpAuthProvider( options: NormalizedClientOptions, ): NormalizedClientOptionsWithAuth { return { diff --git a/src/Client.ts b/src/Client.ts index db9d639f..89ff387d 100644 --- a/src/Client.ts +++ b/src/Client.ts @@ -33,9 +33,10 @@ import { UnstableClient } from "./api/resources/unstable/client/Client.js"; import { VisitorsClient } from "./api/resources/visitors/client/Client.js"; import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.js"; import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "./BaseClient.js"; +import * as core from "./core/index.js"; export declare namespace IntercomClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -201,4 +202,35 @@ export class IntercomClient { public get unstable(): UnstableClient { return (this._unstable ??= new UnstableClient(this._options)); } + + /** + * Make a passthrough request using the SDK's configured auth, retry, logging, etc. + * This is useful for making requests to endpoints not yet supported in the SDK. + * The input can be a URL string, URL object, or Request object. Relative paths are resolved against the configured base URL. + * + * @param {Request | string | URL} input - The URL, path, or Request object. + * @param {RequestInit} init - Standard fetch RequestInit options. + * @param {core.PassthroughRequest.RequestOptions} requestOptions - Per-request overrides (timeout, retries, headers, abort signal). + * @returns {Promise} A standard Response object. + */ + public async fetch( + input: Request | string | URL, + init?: RequestInit, + requestOptions?: core.PassthroughRequest.RequestOptions, + ): Promise { + return core.makePassthroughRequest( + input, + init, + { + baseUrl: this._options.baseUrl ?? this._options.environment, + headers: this._options.headers, + timeoutInSeconds: this._options.timeoutInSeconds, + maxRetries: this._options.maxRetries, + fetch: this._options.fetch, + logging: this._options.logging, + getAuthHeaders: async () => (await this._options.authProvider.getAuthRequest()).headers, + }, + requestOptions, + ); + } } diff --git a/src/api/errors/BadRequestError.ts b/src/api/errors/BadRequestError.ts index 90b9567c..d1af80e2 100644 --- a/src/api/errors/BadRequestError.ts +++ b/src/api/errors/BadRequestError.ts @@ -11,6 +11,11 @@ export class BadRequestError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, BadRequestError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "BadRequestError"; } } diff --git a/src/api/errors/ForbiddenError.ts b/src/api/errors/ForbiddenError.ts index 3d3e38f8..add3d33d 100644 --- a/src/api/errors/ForbiddenError.ts +++ b/src/api/errors/ForbiddenError.ts @@ -5,6 +5,8 @@ import * as errors from "../../errors/index.js"; import type * as Intercom from "../index.js"; export class ForbiddenError extends errors.IntercomError { + public declare readonly body: Intercom.Error_; + constructor(body: Intercom.Error_, rawResponse?: core.RawResponse) { super({ message: "ForbiddenError", @@ -12,6 +14,11 @@ export class ForbiddenError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, ForbiddenError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "ForbiddenError"; } } diff --git a/src/api/errors/NotFoundError.ts b/src/api/errors/NotFoundError.ts index e097f867..76ba666f 100644 --- a/src/api/errors/NotFoundError.ts +++ b/src/api/errors/NotFoundError.ts @@ -11,6 +11,11 @@ export class NotFoundError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, NotFoundError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "NotFoundError"; } } diff --git a/src/api/errors/TooManyRequestsError.ts b/src/api/errors/TooManyRequestsError.ts index 713f4ece..cac87085 100644 --- a/src/api/errors/TooManyRequestsError.ts +++ b/src/api/errors/TooManyRequestsError.ts @@ -5,6 +5,8 @@ import * as errors from "../../errors/index.js"; import type * as Intercom from "../index.js"; export class TooManyRequestsError extends errors.IntercomError { + public declare readonly body: Intercom.Error_; + constructor(body: Intercom.Error_, rawResponse?: core.RawResponse) { super({ message: "TooManyRequestsError", @@ -12,6 +14,11 @@ export class TooManyRequestsError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, TooManyRequestsError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "TooManyRequestsError"; } } diff --git a/src/api/errors/UnauthorizedError.ts b/src/api/errors/UnauthorizedError.ts index 16bbd3af..c258a00e 100644 --- a/src/api/errors/UnauthorizedError.ts +++ b/src/api/errors/UnauthorizedError.ts @@ -5,6 +5,8 @@ import * as errors from "../../errors/index.js"; import type * as Intercom from "../index.js"; export class UnauthorizedError extends errors.IntercomError { + public declare readonly body: Intercom.Error_; + constructor(body: Intercom.Error_, rawResponse?: core.RawResponse) { super({ message: "UnauthorizedError", @@ -12,6 +14,11 @@ export class UnauthorizedError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, UnauthorizedError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "UnauthorizedError"; } } diff --git a/src/api/errors/UnprocessableEntityError.ts b/src/api/errors/UnprocessableEntityError.ts index ab175870..6b769014 100644 --- a/src/api/errors/UnprocessableEntityError.ts +++ b/src/api/errors/UnprocessableEntityError.ts @@ -11,6 +11,11 @@ export class UnprocessableEntityError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, UnprocessableEntityError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "UnprocessableEntityError"; } } diff --git a/src/api/resources/admins/client/Client.ts b/src/api/resources/admins/client/Client.ts index f836356f..c4df6af7 100644 --- a/src/api/resources/admins/client/Client.ts +++ b/src/api/resources/admins/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace AdminsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -35,6 +36,9 @@ export class AdminsClient { * * @param {AdminsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.admins.identify() */ @@ -63,7 +67,7 @@ export class AdminsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -94,6 +98,8 @@ export class AdminsClient { * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.admins.away({ @@ -134,14 +140,14 @@ export class AdminsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `admins/${core.url.encodePathParam(adminId)}/away`, + `admins/${core.url.encodePathParam(adminId, errors.IntercomError)}/away`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -182,6 +188,8 @@ export class AdminsClient { * @param {AdminsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.admins.listAllActivityLogs({ @@ -201,12 +209,10 @@ export class AdminsClient { requestOptions?: AdminsClient.RequestOptions, ): Promise> { const { created_at_after: createdAtAfter, created_at_before: createdAtBefore } = request; - const _queryParams: Record = {}; - _queryParams.created_at_after = createdAtAfter; - if (createdAtBefore != null) { - _queryParams.created_at_before = createdAtBefore; - } - + const _queryParams: Record = { + created_at_after: createdAtAfter, + created_at_before: createdAtBefore, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -223,7 +229,11 @@ export class AdminsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -259,6 +269,8 @@ export class AdminsClient { * @param {AdminsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.admins.list() @@ -286,7 +298,7 @@ export class AdminsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -324,6 +336,8 @@ export class AdminsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.admins.find({ @@ -354,11 +368,11 @@ export class AdminsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `admins/${core.url.encodePathParam(adminId)}`, + `admins/${core.url.encodePathParam(adminId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/admins/client/requests/ConfigureAwayAdminRequest.ts b/src/api/resources/admins/client/requests/ConfigureAwayAdminRequest.ts index 0e21602b..02e2ab55 100644 --- a/src/api/resources/admins/client/requests/ConfigureAwayAdminRequest.ts +++ b/src/api/resources/admins/client/requests/ConfigureAwayAdminRequest.ts @@ -15,13 +15,6 @@ * away_mode_enabled: true, * away_mode_reassign: true * } - * - * @example - * { - * admin_id: 1, - * away_mode_enabled: true, - * away_mode_reassign: true - * } */ export interface ConfigureAwayAdminRequest { /** The unique identifier of a given admin */ diff --git a/src/api/resources/admins/exports.ts b/src/api/resources/admins/exports.ts new file mode 100644 index 00000000..9d203c17 --- /dev/null +++ b/src/api/resources/admins/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AdminsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/admins/types/Admin.ts b/src/api/resources/admins/types/Admin.ts index 957fee42..b6cd51da 100644 --- a/src/api/resources/admins/types/Admin.ts +++ b/src/api/resources/admins/types/Admin.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface Admin { /** String representing the object's type. Always has the value `admin`. */ - type?: string; + type?: string | undefined; /** The id representing the admin. */ id: string; /** The name of the admin. */ @@ -15,20 +15,20 @@ export interface Admin { /** The email of the admin. */ email: string; /** The job title of the admin. */ - job_title?: string; + job_title?: string | undefined; /** Identifies if this admin is currently set in away mode. */ away_mode_enabled: boolean; /** Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. */ away_mode_reassign: boolean; /** The unique identifier of the away status reason */ - away_status_reason_id?: number; + away_status_reason_id?: number | undefined; /** Identifies if this admin has a paid inbox seat to restrict/allow features that require them. */ has_inbox_seat: boolean; /** This object represents the avatar associated with the admin. */ team_ids: number[]; /** The avatar object associated with the admin */ - avatar?: Admin.Avatar; - team_priority_level?: Intercom.TeamPriorityLevel; + avatar?: Admin.Avatar | undefined; + team_priority_level?: Intercom.TeamPriorityLevel | undefined; } export namespace Admin { diff --git a/src/api/types/UpdateVisitorRequestOne.ts b/src/api/resources/aiAgent/exports.ts similarity index 58% rename from src/api/types/UpdateVisitorRequestOne.ts rename to src/api/resources/aiAgent/exports.ts index cfdac3c4..94d57674 100644 --- a/src/api/types/UpdateVisitorRequestOne.ts +++ b/src/api/resources/aiAgent/exports.ts @@ -1,3 +1,3 @@ // This file was auto-generated by Fern from our API Definition. -export type UpdateVisitorRequestOne = unknown; +export * from "./index.js"; diff --git a/src/api/resources/aiAgent/types/AiAgent.ts b/src/api/resources/aiAgent/types/AiAgent.ts index 19ae094e..7750365b 100644 --- a/src/api/resources/aiAgent/types/AiAgent.ts +++ b/src/api/resources/aiAgent/types/AiAgent.ts @@ -7,22 +7,22 @@ import type * as Intercom from "../../../index.js"; */ export interface AiAgent { /** The type of the source that triggered AI Agent involvement in the conversation. */ - source_type?: AiAgent.SourceType; + source_type?: AiAgent.SourceType | undefined; /** The title of the source that triggered AI Agent involvement in the conversation. If this is `essentials_plan_setup` then it will return `null`. */ - source_title?: string; + source_title?: string | undefined; /** The type of the last answer delivered by AI Agent. If no answer was delivered then this will return `null` */ - last_answer_type?: AiAgent.LastAnswerType; + last_answer_type?: AiAgent.LastAnswerType | undefined; /** The resolution state of AI Agent. If no AI or custom answer has been delivered then this will return `null`. */ - resolution_state?: AiAgent.ResolutionState; + resolution_state?: AiAgent.ResolutionState | undefined; /** The customer satisfaction rating given to AI Agent, from 1-5. */ - rating?: number; + rating?: number | undefined; /** The customer satisfaction rating remark given to AI Agent. */ - rating_remark?: string; + rating_remark?: string | undefined; /** The time when the AI agent rating was created. */ - created_at?: number; + created_at?: number | undefined; /** The time when the AI agent rating was last updated. */ - updated_at?: number; - content_sources?: Intercom.ContentSourcesList; + updated_at?: number | undefined; + content_sources?: Intercom.ContentSourcesList | undefined; } export namespace AiAgent { diff --git a/src/api/resources/aiContent/client/Client.ts b/src/api/resources/aiContent/client/Client.ts index 2beabc07..7cd0fc6f 100644 --- a/src/api/resources/aiContent/client/Client.ts +++ b/src/api/resources/aiContent/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace AiContentClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -43,6 +44,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.listContentImportSources() @@ -72,7 +75,7 @@ export class AiContentClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -109,6 +112,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.createContentImportSource({ @@ -143,9 +148,12 @@ export class AiContentClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: { ...request, sync_behavior: "api" }, + body: mergeAdditionalBodyParameters( + { ...request, sync_behavior: "api" }, + requestOptions?.additionalBodyParameters, + ), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -180,6 +188,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.getContentImportSource({ @@ -210,11 +220,11 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/content_import_sources/${core.url.encodePathParam(sourceId)}`, + `ai/content_import_sources/${core.url.encodePathParam(sourceId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -256,6 +266,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.updateContentImportSource({ @@ -288,14 +300,14 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/content_import_sources/${core.url.encodePathParam(sourceId)}`, + `ai/content_import_sources/${core.url.encodePathParam(sourceId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -337,6 +349,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.deleteContentImportSource({ @@ -367,11 +381,11 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/content_import_sources/${core.url.encodePathParam(sourceId)}`, + `ai/content_import_sources/${core.url.encodePathParam(sourceId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -412,6 +426,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.listExternalPages() @@ -441,7 +457,7 @@ export class AiContentClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -478,6 +494,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.createExternalPage({ @@ -516,9 +534,9 @@ export class AiContentClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: { ...request, locale: "en" }, + body: mergeAdditionalBodyParameters({ ...request, locale: "en" }, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -555,6 +573,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.getExternalPage({ @@ -585,11 +605,11 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/external_pages/${core.url.encodePathParam(pageId)}`, + `ai/external_pages/${core.url.encodePathParam(pageId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -626,6 +646,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.updateExternalPage({ @@ -661,14 +683,14 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/external_pages/${core.url.encodePathParam(pageId)}`, + `ai/external_pages/${core.url.encodePathParam(pageId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: { ..._body, locale: "en" }, + body: mergeAdditionalBodyParameters({ ..._body, locale: "en" }, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -705,6 +727,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.aiContent.deleteExternalPage({ @@ -735,11 +759,11 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/external_pages/${core.url.encodePathParam(pageId)}`, + `ai/external_pages/${core.url.encodePathParam(pageId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/aiContent/client/requests/index.ts b/src/api/resources/aiContent/client/requests/index.ts index 2c010829..c6cd1666 100644 --- a/src/api/resources/aiContent/client/requests/index.ts +++ b/src/api/resources/aiContent/client/requests/index.ts @@ -1,8 +1,8 @@ -export type { CreateContentImportSourceRequest } from "./CreateContentImportSourceRequest.js"; +export { CreateContentImportSourceRequest } from "./CreateContentImportSourceRequest.js"; export type { CreateExternalPageRequest } from "./CreateExternalPageRequest.js"; export type { DeleteContentImportSourceRequest } from "./DeleteContentImportSourceRequest.js"; export type { DeleteExternalPageRequest } from "./DeleteExternalPageRequest.js"; export type { GetContentImportSourceRequest } from "./GetContentImportSourceRequest.js"; export type { GetExternalPageRequest } from "./GetExternalPageRequest.js"; -export type { UpdateContentImportSourceRequest } from "./UpdateContentImportSourceRequest.js"; +export { UpdateContentImportSourceRequest } from "./UpdateContentImportSourceRequest.js"; export type { UpdateExternalPageRequest } from "./UpdateExternalPageRequest.js"; diff --git a/src/api/resources/aiContent/exports.ts b/src/api/resources/aiContent/exports.ts new file mode 100644 index 00000000..e1ce7f43 --- /dev/null +++ b/src/api/resources/aiContent/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AiContentClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/aiContent/types/ContentImportSourcesList.ts b/src/api/resources/aiContent/types/ContentImportSourcesList.ts index 8e7018fe..e13e30a3 100644 --- a/src/api/resources/aiContent/types/ContentImportSourcesList.ts +++ b/src/api/resources/aiContent/types/ContentImportSourcesList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface ContentImportSourcesList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.PagesLink; + type?: "list" | undefined; + pages?: Intercom.PagesLink | undefined; /** A count of the total number of content import sources. */ - total_count?: number; + total_count?: number | undefined; /** An array of Content Import Source objects */ - data?: Intercom.ContentImportSource[]; + data?: Intercom.ContentImportSource[] | undefined; } diff --git a/src/api/resources/aiContent/types/ExternalPage.ts b/src/api/resources/aiContent/types/ExternalPage.ts index 97afb31c..9c7b614c 100644 --- a/src/api/resources/aiContent/types/ExternalPage.ts +++ b/src/api/resources/aiContent/types/ExternalPage.ts @@ -13,13 +13,13 @@ export interface ExternalPage { /** The body of the external page in HTML. */ html: string; /** The URL of the external page. This will be used by Fin to link end users to the page it based its answer on. */ - url?: string; + url?: string | undefined; /** Whether the external page should be used to answer questions by AI Agent. */ ai_agent_availability: boolean; /** Whether the external page should be used to answer questions by AI Copilot. */ ai_copilot_availability: boolean; /** Deprecated. Use ai_agent_availability and ai_copilot_availability instead. */ - fin_availability?: boolean; + fin_availability?: boolean | undefined; /** Always en */ locale: "en"; /** The unique identifier for the source of the external page which was given by Intercom. Every external page must be associated with a Content Import Source which represents the place it comes from and from which it inherits a default audience (configured in the UI). For a new source, make a POST request to the Content Import Source endpoint and an ID for the source will be returned in the response. */ diff --git a/src/api/resources/aiContent/types/ExternalPagesList.ts b/src/api/resources/aiContent/types/ExternalPagesList.ts index ec5273ca..b3a2fa3c 100644 --- a/src/api/resources/aiContent/types/ExternalPagesList.ts +++ b/src/api/resources/aiContent/types/ExternalPagesList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface ExternalPagesList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.PagesLink; + type?: "list" | undefined; + pages?: Intercom.PagesLink | undefined; /** A count of the total number of external pages. */ - total_count?: number; + total_count?: number | undefined; /** An array of External Page objects */ - data?: Intercom.ExternalPage[]; + data?: Intercom.ExternalPage[] | undefined; } diff --git a/src/api/types/CreateContactRequestTwo.ts b/src/api/resources/aiContentSource/exports.ts similarity index 58% rename from src/api/types/CreateContactRequestTwo.ts rename to src/api/resources/aiContentSource/exports.ts index 06133b6b..94d57674 100644 --- a/src/api/types/CreateContactRequestTwo.ts +++ b/src/api/resources/aiContentSource/exports.ts @@ -1,3 +1,3 @@ // This file was auto-generated by Fern from our API Definition. -export type CreateContactRequestTwo = unknown; +export * from "./index.js"; diff --git a/src/api/resources/aiContentSource/types/ContentSource.ts b/src/api/resources/aiContentSource/types/ContentSource.ts index 7013e220..496ded68 100644 --- a/src/api/resources/aiContentSource/types/ContentSource.ts +++ b/src/api/resources/aiContentSource/types/ContentSource.ts @@ -5,11 +5,11 @@ */ export interface ContentSource { /** The type of the content source. */ - content_type?: "custom_answer"; + content_type?: "custom_answer" | undefined; /** The internal URL linking to the content source for teammates. */ - url?: string; + url?: string | undefined; /** The title of the content source. */ - title?: string; + title?: string | undefined; /** The ISO 639 language code of the content source. */ - locale?: string; + locale?: string | undefined; } diff --git a/src/api/resources/articles/client/Client.ts b/src/api/resources/articles/client/Client.ts index e101ba3d..b92624e4 100644 --- a/src/api/resources/articles/client/Client.ts +++ b/src/api/resources/articles/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace ArticlesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -36,6 +37,8 @@ export class ArticlesClient { * @param {ArticlesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.articles.list() @@ -47,13 +50,10 @@ export class ArticlesClient { const list = core.HttpResponsePromise.interceptFunction( async (request: Intercom.ListArticlesRequest): Promise> => { const { page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } + const _queryParams: Record = { + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -70,7 +70,11 @@ export class ArticlesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -106,8 +110,15 @@ export class ArticlesClient { hasNextPage: (response) => (response?.data ?? []).length > 0, getItems: (response) => response?.data ?? [], loadPage: (_response) => { - _offset += 1; - return list(core.setObjectProperty(request, "page", _offset)); + const _nextOffset = _offset + 1; + return core.HttpResponsePromise.fromPromise( + list(core.setObjectProperty(request, "page", _nextOffset)) + .withRawResponse() + .then((_pageResponse) => { + _offset = _nextOffset; + return _pageResponse; + }), + ); }, }); } @@ -120,6 +131,8 @@ export class ArticlesClient { * * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.articles.create({ @@ -178,9 +191,9 @@ export class ArticlesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -220,6 +233,8 @@ export class ArticlesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.articles.find({ @@ -250,11 +265,11 @@ export class ArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `articles/${core.url.encodePathParam(articleId)}`, + `articles/${core.url.encodePathParam(articleId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -294,6 +309,8 @@ export class ArticlesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.articles.update({ @@ -326,14 +343,14 @@ export class ArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `articles/${core.url.encodePathParam(articleId)}`, + `articles/${core.url.encodePathParam(articleId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -373,6 +390,8 @@ export class ArticlesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.articles.delete({ @@ -403,11 +422,11 @@ export class ArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `articles/${core.url.encodePathParam(articleId)}`, + `articles/${core.url.encodePathParam(articleId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -446,6 +465,8 @@ export class ArticlesClient { * @param {ArticlesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.articles.search({ @@ -467,23 +488,12 @@ export class ArticlesClient { requestOptions?: ArticlesClient.RequestOptions, ): Promise> { const { phrase, state, help_center_id: helpCenterId, highlight } = request; - const _queryParams: Record = {}; - if (phrase != null) { - _queryParams.phrase = phrase; - } - - if (state != null) { - _queryParams.state = state; - } - - if (helpCenterId != null) { - _queryParams.help_center_id = helpCenterId.toString(); - } - - if (highlight != null) { - _queryParams.highlight = highlight.toString(); - } - + const _queryParams: Record = { + phrase, + state, + help_center_id: helpCenterId, + highlight, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -500,7 +510,11 @@ export class ArticlesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/articles/client/requests/UpdateArticleRequest.ts b/src/api/resources/articles/client/requests/UpdateArticleRequest.ts index 36209811..037740e7 100644 --- a/src/api/resources/articles/client/requests/UpdateArticleRequest.ts +++ b/src/api/resources/articles/client/requests/UpdateArticleRequest.ts @@ -3,13 +3,6 @@ import type * as Intercom from "../../../../index.js"; /** - * @example - * { - * article_id: 1, - * title: "Christmas is here!", - * body: "

New gifts in store for the jolly season

" - * } - * * @example * { * article_id: 1, diff --git a/src/api/resources/articles/client/requests/index.ts b/src/api/resources/articles/client/requests/index.ts index 9376442d..adfca83d 100644 --- a/src/api/resources/articles/client/requests/index.ts +++ b/src/api/resources/articles/client/requests/index.ts @@ -2,4 +2,4 @@ export type { DeleteArticleRequest } from "./DeleteArticleRequest.js"; export type { FindArticleRequest } from "./FindArticleRequest.js"; export type { ListArticlesRequest } from "./ListArticlesRequest.js"; export type { SearchArticlesRequest } from "./SearchArticlesRequest.js"; -export type { UpdateArticleRequest } from "./UpdateArticleRequest.js"; +export { UpdateArticleRequest } from "./UpdateArticleRequest.js"; diff --git a/src/api/resources/articles/exports.ts b/src/api/resources/articles/exports.ts new file mode 100644 index 00000000..9332773b --- /dev/null +++ b/src/api/resources/articles/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ArticlesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/articles/types/Article.ts b/src/api/resources/articles/types/Article.ts index 02667c69..a49ca3e1 100644 --- a/src/api/resources/articles/types/Article.ts +++ b/src/api/resources/articles/types/Article.ts @@ -6,5 +6,5 @@ import type * as Intercom from "../../../index.js"; * The Articles API is a central place to gather all information and take actions on your articles. Articles can live within collections and sections, or alternatively they can stand alone. */ export interface Article extends Intercom.ArticleListItem { - statistics?: Intercom.ArticleStatistics; + statistics?: Intercom.ArticleStatistics | undefined; } diff --git a/src/api/resources/articles/types/ArticleListItem.ts b/src/api/resources/articles/types/ArticleListItem.ts index 426c862a..aba113a2 100644 --- a/src/api/resources/articles/types/ArticleListItem.ts +++ b/src/api/resources/articles/types/ArticleListItem.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface ArticleListItem { /** The type of object - `article`. */ - type?: "article"; + type?: "article" | undefined; /** The unique identifier for the article which is given by Intercom. */ id: string; /** The id of the workspace which the article belongs to. */ @@ -15,9 +15,9 @@ export interface ArticleListItem { /** The title of the article. For multilingual articles, this will be the title of the default language's content. */ title: string; /** The description of the article. For multilingual articles, this will be the description of the default language's content. */ - description?: string; + description?: string | undefined; /** The body of the article in HTML. For multilingual articles, this will be the body of the default language's content. */ - body?: string; + body?: string | undefined; /** The id of the author of the article. For multilingual articles, this will be the id of the author of the default language's content. Must be a teammate on the help center's workspace. */ author_id: number; /** Whether the article is `published` or is a `draft`. For multilingual articles, this will be the state of the default language's content. */ @@ -27,16 +27,16 @@ export interface ArticleListItem { /** The time when the article was last updated. For multilingual articles, this will be the timestamp of last update of the default language's content in seconds. */ updated_at: number; /** The URL of the article. For multilingual articles, this will be the URL of the default language's content. */ - url?: string; + url?: string | undefined; /** The id of the article's parent collection or section. An article without this field stands alone. */ - parent_id?: number; + parent_id?: number | undefined; /** The ids of the article's parent collections or sections. An article without this field stands alone. */ - parent_ids?: number[]; + parent_ids?: number[] | undefined; /** The type of parent, which can either be a `collection` or `section`. */ - parent_type?: string; + parent_type?: string | undefined; /** The default locale of the help center. This field is only returned for multilingual help centers. */ - default_locale?: string; - translated_content?: Intercom.ArticleTranslatedContent; + default_locale?: string | undefined; + translated_content?: Intercom.ArticleTranslatedContent | undefined; } export namespace ArticleListItem { diff --git a/src/api/resources/articles/types/ArticleSearchHighlights.ts b/src/api/resources/articles/types/ArticleSearchHighlights.ts index c80f22fa..d121c6b0 100644 --- a/src/api/resources/articles/types/ArticleSearchHighlights.ts +++ b/src/api/resources/articles/types/ArticleSearchHighlights.ts @@ -5,11 +5,11 @@ */ export interface ArticleSearchHighlights { /** The ID of the corresponding article. */ - article_id?: string; + article_id?: string | undefined; /** An Article title highlighted. */ - highlighted_title?: ArticleSearchHighlights.HighlightedTitle.Item[]; + highlighted_title?: ArticleSearchHighlights.HighlightedTitle.Item[] | undefined; /** An Article description and body text highlighted. */ - highlighted_summary?: ArticleSearchHighlights.HighlightedSummary.Item[][]; + highlighted_summary?: ArticleSearchHighlights.HighlightedSummary.Item[][] | undefined; } export namespace ArticleSearchHighlights { @@ -21,9 +21,9 @@ export namespace ArticleSearchHighlights { */ export interface Item { /** The type of text - `highlight` or `plain`. */ - type?: Item.Type; + type?: Item.Type | undefined; /** The text of the title. */ - text?: string; + text?: string | undefined; } export namespace Item { @@ -44,9 +44,9 @@ export namespace ArticleSearchHighlights { */ export interface Item { /** The type of text - `highlight` or `plain`. */ - type?: Item.Type; + type?: Item.Type | undefined; /** The text of the title. */ - text?: string; + text?: string | undefined; } export namespace Item { diff --git a/src/api/resources/articles/types/ArticleSearchResponse.ts b/src/api/resources/articles/types/ArticleSearchResponse.ts index 349062a8..815a99bc 100644 --- a/src/api/resources/articles/types/ArticleSearchResponse.ts +++ b/src/api/resources/articles/types/ArticleSearchResponse.ts @@ -7,12 +7,12 @@ import type * as Intercom from "../../../index.js"; */ export interface ArticleSearchResponse { /** The type of the object - `list`. */ - type?: "list"; + type?: "list" | undefined; /** The total number of Articles matching the search query */ - total_count?: number; + total_count?: number | undefined; /** An object containing the results of the search. */ - data?: ArticleSearchResponse.Data; - pages?: Intercom.CursorPages; + data?: ArticleSearchResponse.Data | undefined; + pages?: Intercom.CursorPages | undefined; } export namespace ArticleSearchResponse { @@ -21,8 +21,8 @@ export namespace ArticleSearchResponse { */ export interface Data { /** An array of Article objects */ - articles?: Intercom.Article[]; + articles?: Intercom.Article[] | undefined; /** A corresponding array of highlighted Article content */ - highlights?: Intercom.ArticleSearchHighlights[]; + highlights?: Intercom.ArticleSearchHighlights[] | undefined; } } diff --git a/src/api/resources/awayStatusReasons/client/Client.ts b/src/api/resources/awayStatusReasons/client/Client.ts index 22df5064..c2948028 100644 --- a/src/api/resources/awayStatusReasons/client/Client.ts +++ b/src/api/resources/awayStatusReasons/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace AwayStatusReasonsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +31,8 @@ export class AwayStatusReasonsClient { * @param {AwayStatusReasonsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.awayStatusReasons.listAwayStatusReasons() @@ -60,7 +62,7 @@ export class AwayStatusReasonsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/awayStatusReasons/exports.ts b/src/api/resources/awayStatusReasons/exports.ts new file mode 100644 index 00000000..8bd32934 --- /dev/null +++ b/src/api/resources/awayStatusReasons/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AwayStatusReasonsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/calls/client/Client.ts b/src/api/resources/calls/client/Client.ts index 956fcfa5..e7977b96 100644 --- a/src/api/resources/calls/client/Client.ts +++ b/src/api/resources/calls/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace CallsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +33,8 @@ export class CallsClient { * @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.calls.listCalls({ @@ -51,15 +54,10 @@ export class CallsClient { requestOptions?: CallsClient.RequestOptions, ): Promise> { const { page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - + const _queryParams: Record = { + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -76,7 +74,11 @@ export class CallsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -114,6 +116,8 @@ export class CallsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.calls.showCall({ @@ -144,11 +148,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `calls/${core.url.encodePathParam(callId)}`, + `calls/${core.url.encodePathParam(callId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -188,6 +192,8 @@ export class CallsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.calls.showCallRecording({ @@ -218,11 +224,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `calls/${core.url.encodePathParam(callId)}/recording`, + `calls/${core.url.encodePathParam(callId, errors.IntercomError)}/recording`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -261,6 +267,8 @@ export class CallsClient { * @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.calls.showCallTranscript({ @@ -291,11 +299,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `calls/${core.url.encodePathParam(callId)}/transcript`, + `calls/${core.url.encodePathParam(callId, errors.IntercomError)}/transcript`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), responseType: "text", timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, @@ -332,6 +340,8 @@ export class CallsClient { * * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.calls.listCallsWithTranscripts({ @@ -366,9 +376,9 @@ export class CallsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/calls/exports.ts b/src/api/resources/calls/exports.ts new file mode 100644 index 00000000..e77f47c9 --- /dev/null +++ b/src/api/resources/calls/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CallsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/calls/types/Call.ts b/src/api/resources/calls/types/Call.ts index 33b20803..959075df 100644 --- a/src/api/resources/calls/types/Call.ts +++ b/src/api/resources/calls/types/Call.ts @@ -7,36 +7,36 @@ import type * as Intercom from "../../../index.js"; */ export interface Call { /** String representing the object's type. Always has the value `call`. */ - type?: string; + type?: string | undefined; /** The id of the call. */ - id?: string; + id?: string | undefined; /** The id of the conversation associated with the call, if any. */ - conversation_id?: string; + conversation_id?: string | undefined; /** The id of the admin associated with the call, if any. */ - admin_id?: string; + admin_id?: string | undefined; /** The id of the contact associated with the call, if any. */ - contact_id?: string; + contact_id?: string | undefined; /** The current state of the call. */ - state?: string; - initiated_at?: Intercom.Datetime; - answered_at?: Intercom.Datetime; - ended_at?: Intercom.Datetime; - created_at?: Intercom.Datetime; - updated_at?: Intercom.Datetime; + state?: string | undefined; + initiated_at?: Intercom.Datetime | undefined; + answered_at?: Intercom.Datetime | undefined; + ended_at?: Intercom.Datetime | undefined; + created_at?: Intercom.Datetime | undefined; + updated_at?: Intercom.Datetime | undefined; /** API URL to download or redirect to the call recording if available. */ - recording_url?: string; + recording_url?: string | undefined; /** API URL to download or redirect to the call transcript if available. */ - transcription_url?: string; + transcription_url?: string | undefined; /** The type of call. */ - call_type?: string; + call_type?: string | undefined; /** The direction of the call. */ - direction?: string; + direction?: string | undefined; /** The reason for the call end, if applicable. */ - ended_reason?: string; + ended_reason?: string | undefined; /** The phone number involved in the call, in E.164 format. */ - phone?: string; + phone?: string | undefined; /** API URL to the AI Agent (Fin) call recording if available. */ - fin_recording_url?: string; + fin_recording_url?: string | undefined; /** API URL to the AI Agent (Fin) call transcript if available. */ - fin_transcription_url?: string; + fin_transcription_url?: string | undefined; } diff --git a/src/api/resources/calls/types/ListCallsWithTranscriptsResponse.ts b/src/api/resources/calls/types/ListCallsWithTranscriptsResponse.ts index f37c83bc..771a6ec8 100644 --- a/src/api/resources/calls/types/ListCallsWithTranscriptsResponse.ts +++ b/src/api/resources/calls/types/ListCallsWithTranscriptsResponse.ts @@ -3,8 +3,8 @@ import type * as Intercom from "../../../index.js"; export interface ListCallsWithTranscriptsResponse { - type?: string; - data?: ListCallsWithTranscriptsResponse.Data.Item[]; + type?: string | undefined; + data?: ListCallsWithTranscriptsResponse.Data.Item[] | undefined; } export namespace ListCallsWithTranscriptsResponse { @@ -13,9 +13,9 @@ export namespace ListCallsWithTranscriptsResponse { export namespace Data { export interface Item extends Intercom.Call { /** The call transcript if available, otherwise an empty array. */ - transcript?: Record[]; + transcript?: Record[] | undefined; /** The status of the transcript if available. */ - transcript_status?: string; + transcript_status?: string | undefined; } } } diff --git a/src/api/resources/companies/client/Client.ts b/src/api/resources/companies/client/Client.ts index db9cb03e..07dd6ed3 100644 --- a/src/api/resources/companies/client/Client.ts +++ b/src/api/resources/companies/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace CompaniesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -43,6 +44,8 @@ export class CompaniesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.retrieve({ @@ -66,31 +69,14 @@ export class CompaniesClient { requestOptions?: CompaniesClient.RequestOptions, ): Promise> { const { name, company_id: companyId, tag_id: tagId, segment_id: segmentId, page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (name != null) { - _queryParams.name = name; - } - - if (companyId != null) { - _queryParams.company_id = companyId; - } - - if (tagId != null) { - _queryParams.tag_id = tagId; - } - - if (segmentId != null) { - _queryParams.segment_id = segmentId; - } - - if (page != null) { - _queryParams.page = page.toString(); - } - - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - + const _queryParams: Record = { + name, + company_id: companyId, + tag_id: tagId, + segment_id: segmentId, + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -107,7 +93,11 @@ export class CompaniesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -155,6 +145,8 @@ export class CompaniesClient { * * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.createOrUpdate({ @@ -194,9 +186,9 @@ export class CompaniesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -236,6 +228,8 @@ export class CompaniesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.find({ @@ -266,11 +260,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(companyId)}`, + `companies/${core.url.encodePathParam(companyId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -314,6 +308,8 @@ export class CompaniesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.update({ @@ -354,14 +350,14 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(companyId)}`, + `companies/${core.url.encodePathParam(companyId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body != null ? _body : undefined, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -401,6 +397,8 @@ export class CompaniesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.delete({ @@ -431,11 +429,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(companyId)}`, + `companies/${core.url.encodePathParam(companyId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -475,6 +473,8 @@ export class CompaniesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.listAttachedContacts({ @@ -505,11 +505,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(companyId)}/contacts`, + `companies/${core.url.encodePathParam(companyId, errors.IntercomError)}/contacts`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -554,6 +554,8 @@ export class CompaniesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.listAttachedSegments({ @@ -584,11 +586,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(companyId)}/segments`, + `companies/${core.url.encodePathParam(companyId, errors.IntercomError)}/segments`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -640,6 +642,8 @@ export class CompaniesClient { * @param {CompaniesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.list({ @@ -655,16 +659,11 @@ export class CompaniesClient { const list = core.HttpResponsePromise.interceptFunction( async (request: Intercom.ListCompaniesRequest): Promise> => { const { page, per_page: perPage, order } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - if (order != null) { - _queryParams.order = order; - } + const _queryParams: Record = { + page, + per_page: perPage, + order, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -681,7 +680,11 @@ export class CompaniesClient { ), method: "POST", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -717,8 +720,15 @@ export class CompaniesClient { hasNextPage: (response) => (response?.data ?? []).length > 0, getItems: (response) => response?.data ?? [], loadPage: (_response) => { - _offset += 1; - return list(core.setObjectProperty(request, "page", _offset)); + const _nextOffset = _offset + 1; + return core.HttpResponsePromise.fromPromise( + list(core.setObjectProperty(request, "page", _nextOffset)) + .withRawResponse() + .then((_pageResponse) => { + _offset = _nextOffset; + return _pageResponse; + }), + ); }, }); } @@ -744,6 +754,8 @@ export class CompaniesClient { * @param {CompaniesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.scroll({ @@ -759,10 +771,9 @@ export class CompaniesClient { request: Intercom.ScrollCompaniesRequest, ): Promise> => { const { scroll_param: scrollParam } = request; - const _queryParams: Record = {}; - if (scrollParam != null) { - _queryParams.scroll_param = scrollParam; - } + const _queryParams: Record = { + scroll_param: scrollParam, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -779,7 +790,11 @@ export class CompaniesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -833,6 +848,8 @@ export class CompaniesClient { * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.attachContact({ @@ -876,14 +893,14 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/companies`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/companies`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -930,6 +947,8 @@ export class CompaniesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.companies.detachContact({ @@ -961,11 +980,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/companies/${core.url.encodePathParam(companyId)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/companies/${core.url.encodePathParam(companyId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/companies/client/requests/ScrollCompaniesRequest.ts b/src/api/resources/companies/client/requests/ScrollCompaniesRequest.ts index 56661c7f..009fd6d4 100644 --- a/src/api/resources/companies/client/requests/ScrollCompaniesRequest.ts +++ b/src/api/resources/companies/client/requests/ScrollCompaniesRequest.ts @@ -7,6 +7,5 @@ * } */ export interface ScrollCompaniesRequest { - /** */ scroll_param?: string; } diff --git a/src/api/resources/companies/exports.ts b/src/api/resources/companies/exports.ts new file mode 100644 index 00000000..2ca4d184 --- /dev/null +++ b/src/api/resources/companies/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CompaniesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/companies/types/Company.ts b/src/api/resources/companies/types/Company.ts index cb26b686..fd3ec36c 100644 --- a/src/api/resources/companies/types/Company.ts +++ b/src/api/resources/companies/types/Company.ts @@ -7,30 +7,30 @@ import type * as Intercom from "../../../index.js"; */ export interface Company { /** Value is `company` */ - type?: "company"; + type?: "company" | undefined; /** The Intercom defined id representing the company. */ id: string; /** The name of the company. */ name: string; /** The Intercom defined code of the workspace the company is associated to. */ app_id: string; - plan?: Company.Plan; + plan?: Company.Plan | undefined; /** The company id you have defined for the company. */ company_id: string; /** The time the company was created by you. */ - remote_created_at?: number; + remote_created_at?: number | undefined; /** The time the company was added in Intercom. */ created_at: number; /** The last time the company was updated. */ updated_at: number; /** The time the company last recorded making a request. */ - last_request_at?: number; + last_request_at?: number | undefined; /** The number of employees in the company. */ - size?: number; + size?: number | undefined; /** The URL for the company website. */ - website?: string; + website?: string | undefined; /** The industry that the company operates in. */ - industry?: string; + industry?: string | undefined; /** How much revenue the company generates for your business. */ monthly_spend: number; /** How many sessions the company has recorded. */ @@ -38,21 +38,21 @@ export interface Company { /** The number of users in the company. */ user_count: number; /** The custom attributes you have set on the company. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; /** The list of tags associated with the company */ - tags?: Company.Tags; + tags?: Company.Tags | undefined; /** The list of segments associated with the company */ - segments?: Company.Segments; + segments?: Company.Segments | undefined; } export namespace Company { export interface Plan { /** Value is always "plan" */ - type?: string; + type?: string | undefined; /** The id of the plan */ - id?: string; + id?: string | undefined; /** The name of the plan */ - name?: string; + name?: string | undefined; } /** @@ -60,8 +60,8 @@ export namespace Company { */ export interface Tags { /** The type of the object */ - type?: "tag.list"; - tags?: unknown[]; + type?: "tag.list" | undefined; + tags?: unknown[] | undefined; } /** @@ -69,7 +69,7 @@ export namespace Company { */ export interface Segments { /** The type of the object */ - type?: "segment.list"; - segments?: Intercom.Segment[]; + type?: "segment.list" | undefined; + segments?: Intercom.Segment[] | undefined; } } diff --git a/src/api/resources/contacts/client/Client.ts b/src/api/resources/contacts/client/Client.ts index f5ec64f4..f5296c14 100644 --- a/src/api/resources/contacts/client/Client.ts +++ b/src/api/resources/contacts/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace ContactsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +34,8 @@ export class ContactsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.listAttachedCompanies({ @@ -50,13 +53,10 @@ export class ContactsClient { request: Intercom.ListAttachedCompaniesRequest, ): Promise> => { const { contact_id: contactId, page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } + const _queryParams: Record = { + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -69,11 +69,15 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/companies`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/companies`, ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -119,8 +123,15 @@ export class ContactsClient { hasNextPage: (response) => (response?.companies ?? []).length > 0, getItems: (response) => response?.companies ?? [], loadPage: (_response) => { - _offset += 1; - return list(core.setObjectProperty(request, "page", _offset)); + const _nextOffset = _offset + 1; + return core.HttpResponsePromise.fromPromise( + list(core.setObjectProperty(request, "page", _nextOffset)) + .withRawResponse() + .then((_pageResponse) => { + _offset = _nextOffset; + return _pageResponse; + }), + ); }, }); } @@ -133,6 +144,8 @@ export class ContactsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.listAttachedSegments({ @@ -163,11 +176,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/segments`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/segments`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -218,6 +231,8 @@ export class ContactsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.listAttachedSubscriptions({ @@ -248,11 +263,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/subscriptions`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/subscriptions`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -303,6 +318,8 @@ export class ContactsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.attachSubscription({ @@ -342,14 +359,14 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/subscriptions`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/subscriptions`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -394,6 +411,8 @@ export class ContactsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.detachSubscription({ @@ -425,11 +444,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/subscriptions/${core.url.encodePathParam(subscriptionId)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/subscriptions/${core.url.encodePathParam(subscriptionId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -474,6 +493,8 @@ export class ContactsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.listAttachedTags({ @@ -504,11 +525,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/tags`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/tags`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -547,6 +568,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.find({ @@ -577,11 +600,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -624,6 +647,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.update({ @@ -666,14 +691,14 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -710,6 +735,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.delete({ @@ -740,11 +767,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -781,6 +808,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.mergeLeadInUser({ @@ -816,9 +845,9 @@ export class ContactsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -956,6 +985,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.search({ @@ -995,9 +1026,9 @@ export class ContactsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1055,6 +1086,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.list() @@ -1066,16 +1099,11 @@ export class ContactsClient { const list = core.HttpResponsePromise.interceptFunction( async (request: Intercom.ListContactsRequest): Promise> => { const { page, per_page: perPage, starting_after: startingAfter } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - if (startingAfter != null) { - _queryParams.starting_after = startingAfter; - } + const _queryParams: Record = { + page, + per_page: perPage, + starting_after: startingAfter, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -1092,7 +1120,11 @@ export class ContactsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1144,6 +1176,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.create({ @@ -1178,9 +1212,9 @@ export class ContactsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1217,6 +1251,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.contacts.showContactByExternalId({ @@ -1247,11 +1283,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/find_by_external_id/${core.url.encodePathParam(externalId)}`, + `contacts/find_by_external_id/${core.url.encodePathParam(externalId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1295,6 +1331,9 @@ export class ContactsClient { * @param {Intercom.ArchiveContactRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.contacts.archive({ * contact_id: "63a07ddf05a32042dffac965" @@ -1324,11 +1363,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/archive`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/archive`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1361,6 +1400,9 @@ export class ContactsClient { * @param {Intercom.UnarchiveContactRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.contacts.unarchive({ * contact_id: "63a07ddf05a32042dffac965" @@ -1390,11 +1432,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/unarchive`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/unarchive`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1427,6 +1469,9 @@ export class ContactsClient { * @param {Intercom.BlockContactRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.contacts.blockContact({ * contact_id: "63a07ddf05a32042dffac965" @@ -1456,11 +1501,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/block`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/block`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/contacts/client/requests/AttachSubscriptionToContactRequest.ts b/src/api/resources/contacts/client/requests/AttachSubscriptionToContactRequest.ts index 8bd134af..56b8c2f7 100644 --- a/src/api/resources/contacts/client/requests/AttachSubscriptionToContactRequest.ts +++ b/src/api/resources/contacts/client/requests/AttachSubscriptionToContactRequest.ts @@ -11,13 +11,6 @@ * @example * { * contact_id: "63a07ddf05a32042dffac965", - * id: "37846", - * consent_type: "opt_in" - * } - * - * @example - * { - * contact_id: "63a07ddf05a32042dffac965", * id: "invalid_id", * consent_type: "opt_in" * } diff --git a/src/api/resources/contacts/exports.ts b/src/api/resources/contacts/exports.ts new file mode 100644 index 00000000..657fdf5e --- /dev/null +++ b/src/api/resources/contacts/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ContactsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/contacts/types/Contact.ts b/src/api/resources/contacts/types/Contact.ts index 1df7ed44..ff32dff1 100644 --- a/src/api/resources/contacts/types/Contact.ts +++ b/src/api/resources/contacts/types/Contact.ts @@ -11,21 +11,21 @@ export interface Contact { /** The unique identifier for the contact which is given by Intercom. */ id: string; /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; + external_id?: string | undefined; /** The id of the workspace which the contact belongs to. */ workspace_id: string; /** The role of the contact. */ role: string; /** The contact's email. */ - email?: string; + email?: string | undefined; /** The contact's email domain. */ - email_domain?: string; + email_domain?: string | undefined; /** The contacts phone. */ - phone?: string; + phone?: string | undefined; /** The contacts name. */ - name?: string; + name?: string | undefined; /** The id of an admin that has been assigned account ownership of the contact. */ - owner_id?: number; + owner_id?: number | undefined; /** Whether the contact has had an email sent to them hard bounce. */ has_hard_bounced: boolean; /** Whether the contact has marked an email sent to them as spam. */ @@ -37,58 +37,58 @@ export interface Contact { /** (UNIX timestamp) The time when the contact was last updated. */ updated_at: number; /** (UNIX timestamp) The time specified for when a contact signed up. */ - signed_up_at?: number; + signed_up_at?: number | undefined; /** (UNIX timestamp) The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually). */ - last_seen_at?: number; + last_seen_at?: number | undefined; /** (UNIX timestamp) The time when the contact last messaged in. */ - last_replied_at?: number; + last_replied_at?: number | undefined; /** (UNIX timestamp) The time when the contact was last messaged. */ - last_contacted_at?: number; + last_contacted_at?: number | undefined; /** (UNIX timestamp) The time when the contact last opened an email. */ - last_email_opened_at?: number; + last_email_opened_at?: number | undefined; /** (UNIX timestamp) The time when the contact last clicked a link in an email. */ - last_email_clicked_at?: number; + last_email_clicked_at?: number | undefined; /** A preferred language setting for the contact, used by the Intercom Messenger even if their browser settings change. */ - language_override?: string; + language_override?: string | undefined; /** The name of the browser which the contact is using. */ - browser?: string; + browser?: string | undefined; /** The version of the browser which the contact is using. */ - browser_version?: string; + browser_version?: string | undefined; /** The language set by the browser which the contact is using. */ - browser_language?: string; + browser_language?: string | undefined; /** The operating system which the contact is using. */ - os?: string; + os?: string | undefined; /** The name of the Android app which the contact is using. */ - android_app_name?: string; + android_app_name?: string | undefined; /** The version of the Android app which the contact is using. */ - android_app_version?: string; + android_app_version?: string | undefined; /** The Android device which the contact is using. */ - android_device?: string; + android_device?: string | undefined; /** The version of the Android OS which the contact is using. */ - android_os_version?: string; + android_os_version?: string | undefined; /** The version of the Android SDK which the contact is using. */ - android_sdk_version?: string; + android_sdk_version?: string | undefined; /** (UNIX timestamp) The time when the contact was last seen on an Android device. */ - android_last_seen_at?: number; + android_last_seen_at?: number | undefined; /** The name of the iOS app which the contact is using. */ - ios_app_name?: string; + ios_app_name?: string | undefined; /** The version of the iOS app which the contact is using. */ - ios_app_version?: string; + ios_app_version?: string | undefined; /** The iOS device which the contact is using. */ - ios_device?: string; + ios_device?: string | undefined; /** The version of iOS which the contact is using. */ - ios_os_version?: string; + ios_os_version?: string | undefined; /** The version of the iOS SDK which the contact is using. */ - ios_sdk_version?: string; + ios_sdk_version?: string | undefined; /** (UNIX timestamp) The last time the contact used the iOS app. */ - ios_last_seen_at?: number; + ios_last_seen_at?: number | undefined; /** The custom attributes which are set for the contact. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; /** An image URL containing the avatar of a contact. */ - avatar?: string; - tags?: Intercom.ContactTags; - notes?: Intercom.ContactNotes; - companies?: Intercom.ContactCompanies; - location?: Intercom.ContactLocation; - social_profiles?: Intercom.ContactSocialProfiles; + avatar?: string | undefined; + tags?: Intercom.ContactTags | undefined; + notes?: Intercom.ContactNotes | undefined; + companies?: Intercom.ContactCompanies | undefined; + location?: Intercom.ContactLocation | undefined; + social_profiles?: Intercom.ContactSocialProfiles | undefined; } diff --git a/src/api/resources/contacts/types/ContactsCreateResponse.ts b/src/api/resources/contacts/types/ContactsCreateResponse.ts index c124d661..dfd9a155 100644 --- a/src/api/resources/contacts/types/ContactsCreateResponse.ts +++ b/src/api/resources/contacts/types/ContactsCreateResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../index.js"; export interface ContactsCreateResponse extends Intercom.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/contacts/types/ContactsFindResponse.ts b/src/api/resources/contacts/types/ContactsFindResponse.ts index 96ff7ff5..667c6a12 100644 --- a/src/api/resources/contacts/types/ContactsFindResponse.ts +++ b/src/api/resources/contacts/types/ContactsFindResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../index.js"; export interface ContactsFindResponse extends Intercom.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/contacts/types/ContactsMergeLeadInUserResponse.ts b/src/api/resources/contacts/types/ContactsMergeLeadInUserResponse.ts index 95ca8cfb..e13db21b 100644 --- a/src/api/resources/contacts/types/ContactsMergeLeadInUserResponse.ts +++ b/src/api/resources/contacts/types/ContactsMergeLeadInUserResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../index.js"; export interface ContactsMergeLeadInUserResponse extends Intercom.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/contacts/types/ContactsUpdateResponse.ts b/src/api/resources/contacts/types/ContactsUpdateResponse.ts index 736895ee..fe427cba 100644 --- a/src/api/resources/contacts/types/ContactsUpdateResponse.ts +++ b/src/api/resources/contacts/types/ContactsUpdateResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../index.js"; export interface ContactsUpdateResponse extends Intercom.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/contacts/types/ShowContactByExternalIdResponse.ts b/src/api/resources/contacts/types/ShowContactByExternalIdResponse.ts index c6dbf5c1..4850e0ed 100644 --- a/src/api/resources/contacts/types/ShowContactByExternalIdResponse.ts +++ b/src/api/resources/contacts/types/ShowContactByExternalIdResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../index.js"; export interface ShowContactByExternalIdResponse extends Intercom.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/conversations/client/Client.ts b/src/api/resources/conversations/client/Client.ts index af9f6fc0..5388c5ba 100644 --- a/src/api/resources/conversations/client/Client.ts +++ b/src/api/resources/conversations/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace ConversationsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -39,6 +40,8 @@ export class ConversationsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.list({ @@ -55,13 +58,10 @@ export class ConversationsClient { request: Intercom.ListConversationsRequest, ): Promise> => { const { per_page: perPage, starting_after: startingAfter } = request; - const _queryParams: Record = {}; - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - if (startingAfter != null) { - _queryParams.starting_after = startingAfter; - } + const _queryParams: Record = { + per_page: perPage, + starting_after: startingAfter, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -78,7 +78,11 @@ export class ConversationsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -146,6 +150,8 @@ export class ConversationsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.create({ @@ -193,9 +199,9 @@ export class ConversationsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -247,6 +253,8 @@ export class ConversationsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.find({ @@ -271,15 +279,10 @@ export class ConversationsClient { display_as: displayAs, include_translations: includeTranslations, } = request; - const _queryParams: Record = {}; - if (displayAs != null) { - _queryParams.display_as = displayAs; - } - - if (includeTranslations != null) { - _queryParams.include_translations = includeTranslations.toString(); - } - + const _queryParams: Record = { + display_as: displayAs, + include_translations: includeTranslations, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -292,11 +295,15 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -356,6 +363,8 @@ export class ConversationsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.update({ @@ -390,11 +399,9 @@ export class ConversationsClient { requestOptions?: ConversationsClient.RequestOptions, ): Promise> { const { conversation_id: conversationId, display_as: displayAs, ..._body } = request; - const _queryParams: Record = {}; - if (displayAs != null) { - _queryParams.display_as = displayAs; - } - + const _queryParams: Record = { + display_as: displayAs, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -407,14 +414,18 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -461,6 +472,8 @@ export class ConversationsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.deleteConversation({ @@ -491,11 +504,11 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -636,6 +649,9 @@ export class ConversationsClient { * @param {Intercom.SearchRequest} request * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.conversations.search({ * query: { @@ -674,9 +690,9 @@ export class ConversationsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -729,6 +745,8 @@ export class ConversationsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.reply({ @@ -819,14 +837,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/reply`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/reply`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -878,6 +896,8 @@ export class ConversationsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.manage({ @@ -943,14 +963,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/parts`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/parts`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1003,6 +1023,8 @@ export class ConversationsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.attachContactAsAdmin({ @@ -1046,14 +1068,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/customers`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/customers`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1107,6 +1129,8 @@ export class ConversationsClient { * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.NotFoundError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.detachContactAsAdmin({ @@ -1139,14 +1163,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/customers/${core.url.encodePathParam(contactId)}`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/customers/${core.url.encodePathParam(contactId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1200,6 +1224,8 @@ export class ConversationsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.redactConversationPart({ @@ -1243,9 +1269,9 @@ export class ConversationsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1284,6 +1310,8 @@ export class ConversationsClient { * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.BadRequestError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.convertToTicket({ @@ -1321,14 +1349,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/convert`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/convert`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1375,6 +1403,8 @@ export class ConversationsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.conversations.runAssignmentRules({ @@ -1405,11 +1435,11 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/run_assignment_rules`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/run_assignment_rules`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/conversations/client/requests/DetachContactFromConversationRequest.ts b/src/api/resources/conversations/client/requests/DetachContactFromConversationRequest.ts index 415bfae9..12fcfce7 100644 --- a/src/api/resources/conversations/client/requests/DetachContactFromConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/DetachContactFromConversationRequest.ts @@ -1,27 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * conversation_id: "123", - * contact_id: "123", - * admin_id: "5017690" - * } - * - * @example - * { - * conversation_id: "123", - * contact_id: "123", - * admin_id: "5017690" - * } - * - * @example - * { - * conversation_id: "123", - * contact_id: "123", - * admin_id: "5017690" - * } - * * @example * { * conversation_id: "123", diff --git a/src/api/resources/conversations/client/requests/ManageConversationPartsRequest.ts b/src/api/resources/conversations/client/requests/ManageConversationPartsRequest.ts index a16fe3ec..5924bdcd 100644 --- a/src/api/resources/conversations/client/requests/ManageConversationPartsRequest.ts +++ b/src/api/resources/conversations/client/requests/ManageConversationPartsRequest.ts @@ -42,16 +42,6 @@ import type * as Intercom from "../../../../index.js"; * assignee_id: "4324241" * } * } - * - * @example - * { - * conversation_id: "123", - * body: { - * message_type: "close", - * type: "admin", - * admin_id: "12345" - * } - * } */ export interface ManageConversationPartsRequest { /** The identifier for the conversation as given by Intercom. */ diff --git a/src/api/resources/conversations/client/requests/ReplyToConversationRequest.ts b/src/api/resources/conversations/client/requests/ReplyToConversationRequest.ts index 9ef917d8..1108b309 100644 --- a/src/api/resources/conversations/client/requests/ReplyToConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/ReplyToConversationRequest.ts @@ -67,39 +67,6 @@ import type * as Intercom from "../../../../index.js"; * intercom_user_id: "6762f1661bb69f9f2193bbbf" * } * } - * - * @example - * { - * conversation_id: "123 or \"last\"", - * body: { - * message_type: "comment", - * type: "user", - * body: "Thanks again :)", - * intercom_user_id: "6762f1571bb69f9f2193bbbb" - * } - * } - * - * @example - * { - * conversation_id: "123 or \"last\"", - * body: { - * message_type: "comment", - * type: "user", - * body: "Thanks again :)", - * intercom_user_id: "6762f1571bb69f9f2193bbbb" - * } - * } - * - * @example - * { - * conversation_id: "123 or \"last\"", - * body: { - * message_type: "comment", - * type: "user", - * body: "Thanks again :)", - * intercom_user_id: "6762f1571bb69f9f2193bbbb" - * } - * } */ export interface ReplyToConversationRequest { /** The Intercom provisioned identifier for the conversation or the string "last" to reply to the last part of the conversation */ diff --git a/src/api/resources/conversations/client/requests/UpdateConversationRequest.ts b/src/api/resources/conversations/client/requests/UpdateConversationRequest.ts index 164ecefe..682a3466 100644 --- a/src/api/resources/conversations/client/requests/UpdateConversationRequest.ts +++ b/src/api/resources/conversations/client/requests/UpdateConversationRequest.ts @@ -23,18 +23,6 @@ import type * as Intercom from "../../../../index.js"; * "order": {} * } * } - * - * @example - * { - * conversation_id: "conversation_id", - * display_as: "plaintext", - * read: true, - * title: "new conversation title", - * custom_attributes: { - * "issue_type": "Billing", - * "priority": "High" - * } - * } */ export interface UpdateConversationRequest { /** The id of the conversation to target */ diff --git a/src/api/resources/conversations/client/requests/index.ts b/src/api/resources/conversations/client/requests/index.ts index dbe79ca7..f04cfce0 100644 --- a/src/api/resources/conversations/client/requests/index.ts +++ b/src/api/resources/conversations/client/requests/index.ts @@ -1,7 +1,7 @@ export type { AttachContactToConversationRequest } from "./AttachContactToConversationRequest.js"; export type { AutoAssignConversationRequest } from "./AutoAssignConversationRequest.js"; export type { ConvertConversationToTicketRequest } from "./ConvertConversationToTicketRequest.js"; -export type { CreateConversationRequest } from "./CreateConversationRequest.js"; +export { CreateConversationRequest } from "./CreateConversationRequest.js"; export type { DeleteConversationRequest } from "./DeleteConversationRequest.js"; export type { DetachContactFromConversationRequest } from "./DetachContactFromConversationRequest.js"; export type { FindConversationRequest } from "./FindConversationRequest.js"; diff --git a/src/api/resources/conversations/exports.ts b/src/api/resources/conversations/exports.ts new file mode 100644 index 00000000..82be4a7f --- /dev/null +++ b/src/api/resources/conversations/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ConversationsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/conversations/types/Conversation.ts b/src/api/resources/conversations/types/Conversation.ts index bf5334b2..be444ceb 100644 --- a/src/api/resources/conversations/types/Conversation.ts +++ b/src/api/resources/conversations/types/Conversation.ts @@ -11,15 +11,15 @@ export interface Conversation { /** The id representing the conversation. */ id: string; /** The title given to the conversation. */ - title?: string; + title?: string | undefined; /** The time the conversation was created. */ created_at: number; /** The last time the conversation was updated. */ updated_at: number; /** The last time a Contact responded to an Admin. In other words, the time a customer started waiting for a response. Set to null if last reply is from an Admin. */ - waiting_since?: number; + waiting_since?: number | undefined; /** If set this is the time in the future when this conversation will be marked as open. i.e. it will be in a snoozed state until this time. i.e. it will be in a snoozed state until this time. */ - snoozed_until?: number; + snoozed_until?: number | undefined; /** Indicates whether a conversation is open (true) or closed (false). */ open: boolean; /** Can be set to "open", "closed" or "snoozed". */ @@ -27,27 +27,27 @@ export interface Conversation { /** Indicates whether a conversation has been read. */ read: boolean; /** If marked as priority, it will return priority or else not_priority. */ - priority?: Conversation.Priority; + priority?: Conversation.Priority | undefined; /** The id of the admin assigned to the conversation. If it's not assigned to an admin it will return null. */ - admin_assignee_id?: number; + admin_assignee_id?: number | undefined; /** The id of the team assigned to the conversation. If it's not assigned to a team it will return null. */ - team_assignee_id?: string; + team_assignee_id?: string | undefined; /** The ID of the company that the conversation is associated with. The unique identifier for the company which is given by Intercom. */ - company_id?: string; - tags?: Intercom.Tags; - conversation_rating?: Intercom.ConversationRating; + company_id?: string | undefined; + tags?: Intercom.Tags | undefined; + conversation_rating?: Intercom.ConversationRating | undefined; source: Intercom.ConversationSource; contacts: Intercom.ConversationContacts; - teammates?: Intercom.ConversationTeammates; + teammates?: Intercom.ConversationTeammates | undefined; custom_attributes: Intercom.CustomAttributes; - first_contact_reply?: Intercom.ConversationFirstContactReply; - sla_applied?: Intercom.SlaApplied; - statistics?: Intercom.ConversationStatistics; - conversation_parts?: Intercom.ConversationParts; - linked_objects?: Intercom.LinkedObjectList; + first_contact_reply?: Intercom.ConversationFirstContactReply | undefined; + sla_applied?: Intercom.SlaApplied | undefined; + statistics?: Intercom.ConversationStatistics | undefined; + conversation_parts?: Intercom.ConversationParts | undefined; + linked_objects?: Intercom.LinkedObjectList | undefined; /** Indicates whether the AI Agent participated in the conversation. */ - ai_agent_participated?: boolean; - ai_agent?: Intercom.AiAgent; + ai_agent_participated?: boolean | undefined; + ai_agent?: Intercom.AiAgent | undefined; } export namespace Conversation { diff --git a/src/api/resources/customChannelEvents/client/Client.ts b/src/api/resources/customChannelEvents/client/Client.ts index 4ba0127c..9f007b04 100644 --- a/src/api/resources/customChannelEvents/client/Client.ts +++ b/src/api/resources/customChannelEvents/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace CustomChannelEventsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -40,6 +41,8 @@ export class CustomChannelEventsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customChannelEvents.notifyNewConversation({ @@ -79,9 +82,9 @@ export class CustomChannelEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -136,6 +139,8 @@ export class CustomChannelEventsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customChannelEvents.notifyNewMessage({ @@ -176,9 +181,9 @@ export class CustomChannelEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -233,6 +238,8 @@ export class CustomChannelEventsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customChannelEvents.notifyQuickReplySelected({ @@ -275,9 +282,9 @@ export class CustomChannelEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -332,6 +339,8 @@ export class CustomChannelEventsClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customChannelEvents.notifyAttributeCollected({ @@ -375,9 +384,9 @@ export class CustomChannelEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/customChannelEvents/exports.ts b/src/api/resources/customChannelEvents/exports.ts new file mode 100644 index 00000000..39f83221 --- /dev/null +++ b/src/api/resources/customChannelEvents/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CustomChannelEventsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/customObjectInstances/client/Client.ts b/src/api/resources/customObjectInstances/client/Client.ts index 0ae03367..c8f58c4d 100644 --- a/src/api/resources/customObjectInstances/client/Client.ts +++ b/src/api/resources/customObjectInstances/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace CustomObjectInstancesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -36,6 +37,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customObjectInstances.getCustomObjectInstancesByExternalId({ @@ -57,8 +60,9 @@ export class CustomObjectInstancesClient { requestOptions?: CustomObjectInstancesClient.RequestOptions, ): Promise> { const { custom_object_type_identifier: customObjectTypeIdentifier, external_id: externalId } = request; - const _queryParams: Record = {}; - _queryParams.external_id = externalId; + const _queryParams: Record = { + external_id: externalId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -71,11 +75,15 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -123,6 +131,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customObjectInstances.createCustomObjectInstances({ @@ -160,14 +170,14 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -215,6 +225,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customObjectInstances.deleteCustomObjectInstancesById({ @@ -234,8 +246,9 @@ export class CustomObjectInstancesClient { requestOptions?: CustomObjectInstancesClient.RequestOptions, ): Promise> { const { custom_object_type_identifier: customObjectTypeIdentifier, external_id: externalId } = request; - const _queryParams: Record = {}; - _queryParams.external_id = externalId; + const _queryParams: Record = { + external_id: externalId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -248,11 +261,15 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -297,6 +314,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customObjectInstances.getCustomObjectInstancesById({ @@ -331,11 +350,11 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}/${core.url.encodePathParam(customObjectInstanceId)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}/${core.url.encodePathParam(customObjectInstanceId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -383,6 +402,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.customObjectInstances.deleteCustomObjectInstancesByExternalId({ @@ -419,11 +440,11 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}/${core.url.encodePathParam(customObjectInstanceId)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}/${core.url.encodePathParam(customObjectInstanceId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/customObjectInstances/exports.ts b/src/api/resources/customObjectInstances/exports.ts new file mode 100644 index 00000000..2d0a967b --- /dev/null +++ b/src/api/resources/customObjectInstances/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CustomObjectInstancesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/customObjectInstances/types/CustomObjectInstance.ts b/src/api/resources/customObjectInstances/types/CustomObjectInstance.ts index a4363acf..74c0157a 100644 --- a/src/api/resources/customObjectInstances/types/CustomObjectInstance.ts +++ b/src/api/resources/customObjectInstances/types/CustomObjectInstance.ts @@ -5,19 +5,19 @@ */ export interface CustomObjectInstance { /** The Intercom defined id representing the custom object instance. */ - id?: string; + id?: string | undefined; /** The id you have defined for the custom object instance. */ - external_id?: string; + external_id?: string | undefined; /** The time when the Custom Object instance was created in the external system it originated from. */ - external_created_at?: number; + external_created_at?: number | undefined; /** The time when the Custom Object instance was last updated in the external system it originated from. */ - external_updated_at?: number; + external_updated_at?: number | undefined; /** The time the attribute was created as a UTC Unix timestamp */ - created_at?: number; + created_at?: number | undefined; /** The time the attribute was last updated as a UTC Unix timestamp */ - updated_at?: number; + updated_at?: number | undefined; /** The identifier of the custom object type that defines the structure of the custom object instance. */ - type?: string; + type?: string | undefined; /** The custom attributes you have set on the custom object instance. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; } diff --git a/src/api/resources/dataAttributes/client/Client.ts b/src/api/resources/dataAttributes/client/Client.ts index acff8f55..093ec077 100644 --- a/src/api/resources/dataAttributes/client/Client.ts +++ b/src/api/resources/dataAttributes/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace DataAttributesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +33,8 @@ export class DataAttributesClient { * @param {DataAttributesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.dataAttributes.list({ @@ -51,15 +54,10 @@ export class DataAttributesClient { requestOptions?: DataAttributesClient.RequestOptions, ): Promise> { const { model, include_archived: includeArchived } = request; - const _queryParams: Record = {}; - if (model != null) { - _queryParams.model = model; - } - - if (includeArchived != null) { - _queryParams.include_archived = includeArchived.toString(); - } - + const _queryParams: Record = { + model: model != null ? model : undefined, + include_archived: includeArchived, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -76,7 +74,11 @@ export class DataAttributesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -114,6 +116,8 @@ export class DataAttributesClient { * * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.dataAttributes.create({ @@ -160,9 +164,9 @@ export class DataAttributesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -209,6 +213,8 @@ export class DataAttributesClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.dataAttributes.update({ @@ -267,14 +273,14 @@ export class DataAttributesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `data_attributes/${core.url.encodePathParam(dataAttributeId)}`, + `data_attributes/${core.url.encodePathParam(dataAttributeId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts b/src/api/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts index 4b29b995..151d7771 100644 --- a/src/api/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts +++ b/src/api/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts @@ -31,18 +31,6 @@ import type * as Intercom from "../../../../index.js"; * { * data_attribute_id: 1, * body: { - * options: [{ - * value: "1-10" - * }, { - * value: "11-20" - * }] - * } - * } - * - * @example - * { - * data_attribute_id: 1, - * body: { * "description": "Trying to archieve", * "archived": true * } diff --git a/src/api/resources/dataAttributes/exports.ts b/src/api/resources/dataAttributes/exports.ts new file mode 100644 index 00000000..80f9fc3a --- /dev/null +++ b/src/api/resources/dataAttributes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { DataAttributesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/dataAttributes/types/DataAttribute.ts b/src/api/resources/dataAttributes/types/DataAttribute.ts index a2dbee88..4c0a3e8a 100644 --- a/src/api/resources/dataAttributes/types/DataAttribute.ts +++ b/src/api/resources/dataAttributes/types/DataAttribute.ts @@ -7,9 +7,9 @@ export interface DataAttribute { /** Value is `data_attribute`. */ type: "data_attribute"; /** The unique identifier for the data attribute which is given by Intercom. Only available for custom attributes. */ - id?: number; + id?: number | undefined; /** Value is `contact` for user/lead attributes and `company` for company attributes. */ - model?: DataAttribute.Model; + model?: DataAttribute.Model | undefined; /** Name of the attribute. */ name: string; /** Full name of the attribute. Should match the name unless it's a nested attribute. We can split full_name on `.` to access nested user object values. */ @@ -17,27 +17,27 @@ export interface DataAttribute { /** Readable name of the attribute (i.e. name you see in the UI) */ label: string; /** Readable description of the attribute. */ - description?: string; + description?: string | undefined; /** The data type of the attribute. */ data_type: DataAttribute.DataType; /** List of predefined options for attribute value. */ - options?: string[]; + options?: string[] | undefined; /** Can this attribute be updated through API */ - api_writable?: boolean; + api_writable?: boolean | undefined; /** Can this attribute be updated by the Messenger */ - messenger_writable?: boolean; + messenger_writable?: boolean | undefined; /** Can this attribute be updated in the UI */ - ui_writable?: boolean; + ui_writable?: boolean | undefined; /** Set to true if this is a CDA */ - custom?: boolean; + custom?: boolean | undefined; /** Is this attribute archived. (Only applicable to CDAs) */ - archived?: boolean; + archived?: boolean | undefined; /** The time the attribute was created as a UTC Unix timestamp */ - created_at?: number; + created_at?: number | undefined; /** The time the attribute was last updated as a UTC Unix timestamp */ - updated_at?: number; + updated_at?: number | undefined; /** Teammate who created the attribute. Only applicable to CDAs */ - admin_id?: string; + admin_id?: string | undefined; } export namespace DataAttribute { diff --git a/src/api/types/CreateDataEventRequestTwo.ts b/src/api/resources/dataEvents/exports.ts similarity index 57% rename from src/api/types/CreateDataEventRequestTwo.ts rename to src/api/resources/dataEvents/exports.ts index d4d0d15e..94d57674 100644 --- a/src/api/types/CreateDataEventRequestTwo.ts +++ b/src/api/resources/dataEvents/exports.ts @@ -1,3 +1,3 @@ // This file was auto-generated by Fern from our API Definition. -export type CreateDataEventRequestTwo = unknown; +export * from "./index.js"; diff --git a/src/api/resources/dataEvents/types/DataEvent.ts b/src/api/resources/dataEvents/types/DataEvent.ts index 6efc5389..bca57538 100644 --- a/src/api/resources/dataEvents/types/DataEvent.ts +++ b/src/api/resources/dataEvents/types/DataEvent.ts @@ -11,13 +11,13 @@ export interface DataEvent { /** The time the event occurred as a UTC Unix timestamp */ created_at: number; /** Your identifier for the user. */ - user_id?: string; + user_id?: string | undefined; /** Your identifier for a lead or a user. */ - id?: string; + id?: string | undefined; /** The Intercom identifier for the user. */ - intercom_user_id?: string; + intercom_user_id?: string | undefined; /** An email address for your user. An email should only be used where your application uses email to uniquely identify users. */ - email?: string; + email?: string | undefined; /** Optional metadata about the event. */ - metadata?: Record; + metadata?: Record | undefined; } diff --git a/src/api/resources/dataExport/client/Client.ts b/src/api/resources/dataExport/client/Client.ts index f9ea23e2..eb7d9d1b 100644 --- a/src/api/resources/dataExport/client/Client.ts +++ b/src/api/resources/dataExport/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace DataExportClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -30,6 +31,8 @@ export class DataExportClient { * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.dataExport.exportReportingData({ @@ -50,9 +53,10 @@ export class DataExportClient { requestOptions?: DataExportClient.RequestOptions, ): Promise> { const { job_identifier: jobIdentifier, app_id: appId, client_id: clientId } = request; - const _queryParams: Record = {}; - _queryParams.app_id = appId; - _queryParams.client_id = clientId; + const _queryParams: Record = { + app_id: appId, + client_id: clientId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -65,11 +69,15 @@ export class DataExportClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `export/reporting_data/${core.url.encodePathParam(jobIdentifier)}`, + `export/reporting_data/${core.url.encodePathParam(jobIdentifier, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -115,6 +123,8 @@ export class DataExportClient { * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.dataExport.downloadReportingDataExport({ @@ -134,8 +144,9 @@ export class DataExportClient { requestOptions?: DataExportClient.RequestOptions, ): Promise> { const { job_identifier: jobIdentifier, app_id: appId } = request; - const _queryParams: Record = {}; - _queryParams.app_id = appId; + const _queryParams: Record = { + app_id: appId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -151,11 +162,15 @@ export class DataExportClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `download/reporting_data/${core.url.encodePathParam(jobIdentifier)}`, + `download/reporting_data/${core.url.encodePathParam(jobIdentifier, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -207,6 +222,9 @@ export class DataExportClient { * @param {Intercom.CreateDataExportRequest} request * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.dataExport.create({ * created_at_after: 1734519776, @@ -241,9 +259,9 @@ export class DataExportClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -275,6 +293,9 @@ export class DataExportClient { * @param {Intercom.FindDataExportRequest} request * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.dataExport.find({ * job_identifier: "job_identifier" @@ -304,11 +325,11 @@ export class DataExportClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `export/content/data/${core.url.encodePathParam(jobIdentifier)}`, + `export/content/data/${core.url.encodePathParam(jobIdentifier, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -341,6 +362,9 @@ export class DataExportClient { * @param {Intercom.CancelDataExportRequest} request * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.dataExport.cancel({ * job_identifier: "job_identifier" @@ -370,11 +394,11 @@ export class DataExportClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `export/cancel/${core.url.encodePathParam(jobIdentifier)}`, + `export/cancel/${core.url.encodePathParam(jobIdentifier, errors.IntercomError)}`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -413,6 +437,9 @@ export class DataExportClient { * @param {Intercom.DownloadDataExportRequest} request * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.dataExport.download({ * job_identifier: "job_identifier" @@ -442,11 +469,11 @@ export class DataExportClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `download/content/data/${core.url.encodePathParam(jobIdentifier)}`, + `download/content/data/${core.url.encodePathParam(jobIdentifier, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/dataExport/client/requests/ExportReportingDataRequest.ts b/src/api/resources/dataExport/client/requests/ExportReportingDataRequest.ts index 15b8c300..d70eceec 100644 --- a/src/api/resources/dataExport/client/requests/ExportReportingDataRequest.ts +++ b/src/api/resources/dataExport/client/requests/ExportReportingDataRequest.ts @@ -1,13 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * job_identifier: "job_identifier", - * app_id: "app_id", - * client_id: "client_id" - * } - * * @example * { * job_identifier: "job_identifier", diff --git a/src/api/resources/dataExport/exports.ts b/src/api/resources/dataExport/exports.ts new file mode 100644 index 00000000..5d6f94df --- /dev/null +++ b/src/api/resources/dataExport/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { DataExportClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/dataExport/types/DataExport.ts b/src/api/resources/dataExport/types/DataExport.ts index 002d8072..057c2505 100644 --- a/src/api/resources/dataExport/types/DataExport.ts +++ b/src/api/resources/dataExport/types/DataExport.ts @@ -5,13 +5,13 @@ */ export interface DataExport { /** The identifier for your job. */ - job_identifier?: string; + job_identifier?: string | undefined; /** The current state of your job. */ - status?: DataExport.Status; + status?: DataExport.Status | undefined; /** The time after which you will not be able to access the data. */ - download_expires_at?: string; + download_expires_at?: string | undefined; /** The location where you can download your data. */ - download_url?: string; + download_url?: string | undefined; } export namespace DataExport { diff --git a/src/api/resources/dataExport/types/DataExportExportReportingDataResponse.ts b/src/api/resources/dataExport/types/DataExportExportReportingDataResponse.ts index 1eda3ab4..38b772e0 100644 --- a/src/api/resources/dataExport/types/DataExportExportReportingDataResponse.ts +++ b/src/api/resources/dataExport/types/DataExportExportReportingDataResponse.ts @@ -1,8 +1,8 @@ // This file was auto-generated by Fern from our API Definition. export interface DataExportExportReportingDataResponse { - job_identifier?: string; - status?: string; - download_url?: string; - download_expires_at?: string; + job_identifier?: string | undefined; + status?: string | undefined; + download_url?: string | undefined; + download_expires_at?: string | undefined; } diff --git a/src/api/resources/events/client/Client.ts b/src/api/resources/events/client/Client.ts index 2c645b76..3e5e0282 100644 --- a/src/api/resources/events/client/Client.ts +++ b/src/api/resources/events/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace EventsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -42,6 +43,8 @@ export class EventsClient { * @param {EventsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.events.list({ @@ -72,28 +75,14 @@ export class EventsClient { summary, per_page: perPage, } = request; - const _queryParams: Record = {}; - if (userId != null) { - _queryParams.user_id = userId; - } - - if (intercomUserId != null) { - _queryParams.intercom_user_id = intercomUserId; - } - - if (email != null) { - _queryParams.email = email; - } - - _queryParams.type = type_; - if (summary != null) { - _queryParams.summary = summary.toString(); - } - - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - + const _queryParams: Record = { + user_id: userId, + intercom_user_id: intercomUserId, + email, + type: type_, + summary, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -110,7 +99,11 @@ export class EventsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -188,6 +181,8 @@ export class EventsClient { * @param {EventsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.events.create({ @@ -224,9 +219,9 @@ export class EventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -264,6 +259,8 @@ export class EventsClient { * @param {EventsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.events.summaries() @@ -296,9 +293,9 @@ export class EventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/events/client/requests/ListEventSummariesRequest.ts b/src/api/resources/events/client/requests/ListEventSummariesRequest.ts index 6c0d7bca..4bc5219d 100644 --- a/src/api/resources/events/client/requests/ListEventSummariesRequest.ts +++ b/src/api/resources/events/client/requests/ListEventSummariesRequest.ts @@ -17,12 +17,12 @@ export namespace ListEventSummariesRequest { */ export interface EventSummaries { /** The name of the event that occurred. A good event name is typically a past tense 'verb-noun' combination, to improve readability, for example `updated-plan`. */ - event_name?: string; + event_name?: string | undefined; /** The number of times the event occurred. */ - count?: number; + count?: number | undefined; /** The first time the event was sent */ - first?: number; + first?: number | undefined; /** The last time the event was sent */ - last?: number; + last?: number | undefined; } } diff --git a/src/api/resources/events/exports.ts b/src/api/resources/events/exports.ts new file mode 100644 index 00000000..64c4a046 --- /dev/null +++ b/src/api/resources/events/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { EventsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/export/client/Client.ts b/src/api/resources/export/client/Client.ts index 521fe210..84e36e77 100644 --- a/src/api/resources/export/client/Client.ts +++ b/src/api/resources/export/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace ExportClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -29,6 +30,8 @@ export class ExportClient { * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.TooManyRequestsError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.export.enqueueANewReportingDataExportJob({ @@ -66,9 +69,9 @@ export class ExportClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -116,6 +119,9 @@ export class ExportClient { /** * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.export.listAvailableDatasetsAndAttributes() */ @@ -144,7 +150,7 @@ export class ExportClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/export/exports.ts b/src/api/resources/export/exports.ts new file mode 100644 index 00000000..687fe9f8 --- /dev/null +++ b/src/api/resources/export/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ExportClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts b/src/api/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts index 725ac29a..68f80121 100644 --- a/src/api/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts +++ b/src/api/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts @@ -1,8 +1,8 @@ // This file was auto-generated by Fern from our API Definition. export interface GetExportReportingDataGetDatasetsResponse { - type?: string; - data?: GetExportReportingDataGetDatasetsResponse.Data.Item[]; + type?: string | undefined; + data?: GetExportReportingDataGetDatasetsResponse.Data.Item[] | undefined; } export namespace GetExportReportingDataGetDatasetsResponse { @@ -10,11 +10,11 @@ export namespace GetExportReportingDataGetDatasetsResponse { export namespace Data { export interface Item { - id?: string; - name?: string; - description?: string; - default_time_attribute_id?: string; - attributes?: Item.Attributes.Item[]; + id?: string | undefined; + name?: string | undefined; + description?: string | undefined; + default_time_attribute_id?: string | undefined; + attributes?: Item.Attributes.Item[] | undefined; } export namespace Item { @@ -22,8 +22,8 @@ export namespace GetExportReportingDataGetDatasetsResponse { export namespace Attributes { export interface Item { - id?: string; - name?: string; + id?: string | undefined; + name?: string | undefined; } } } diff --git a/src/api/resources/export/types/PostExportReportingDataEnqueueResponse.ts b/src/api/resources/export/types/PostExportReportingDataEnqueueResponse.ts index c15d988e..9e9681d0 100644 --- a/src/api/resources/export/types/PostExportReportingDataEnqueueResponse.ts +++ b/src/api/resources/export/types/PostExportReportingDataEnqueueResponse.ts @@ -1,8 +1,8 @@ // This file was auto-generated by Fern from our API Definition. export interface PostExportReportingDataEnqueueResponse { - job_identifier?: string; - status?: string; - download_url?: string; - download_expires_at?: string; + job_identifier?: string | undefined; + status?: string | undefined; + download_url?: string | undefined; + download_expires_at?: string | undefined; } diff --git a/src/api/resources/helpCenter/exports.ts b/src/api/resources/helpCenter/exports.ts new file mode 100644 index 00000000..94d57674 --- /dev/null +++ b/src/api/resources/helpCenter/exports.ts @@ -0,0 +1,3 @@ +// This file was auto-generated by Fern from our API Definition. + +export * from "./index.js"; diff --git a/src/api/resources/helpCenter/types/Collection.ts b/src/api/resources/helpCenter/types/Collection.ts index 7c9a53b2..a303e658 100644 --- a/src/api/resources/helpCenter/types/Collection.ts +++ b/src/api/resources/helpCenter/types/Collection.ts @@ -13,22 +13,22 @@ export interface Collection { /** The name of the collection. For multilingual collections, this will be the name of the default language's content. */ name: string; /** The description of the collection. For multilingual help centers, this will be the description of the collection for the default language. */ - description?: string; + description?: string | undefined; /** The time when the article was created (seconds). For multilingual articles, this will be the timestamp of creation of the default language's content. */ created_at: number; /** The time when the article was last updated (seconds). For multilingual articles, this will be the timestamp of last update of the default language's content. */ - updated_at?: number; + updated_at?: number | undefined; /** The URL of the collection. For multilingual help centers, this will be the URL of the collection for the default language. */ - url?: string; + url?: string | undefined; /** The icon of the collection. */ - icon?: string; + icon?: string | undefined; /** The order of the section in relation to others sections within a collection. Values go from `0` upwards. `0` is the default if there's no order. */ order: number; /** The default locale of the help center. This field is only returned for multilingual help centers. */ - default_locale?: string; - translated_content?: Intercom.GroupTranslatedContent; + default_locale?: string | undefined; + translated_content?: Intercom.GroupTranslatedContent | undefined; /** The id of the parent collection. If `null` then it is the first level collection. */ - parent_id?: string; + parent_id?: string | undefined; /** The id of the help center the collection is in. */ - help_center_id?: number; + help_center_id?: number | undefined; } diff --git a/src/api/resources/helpCenter/types/HelpCenter.ts b/src/api/resources/helpCenter/types/HelpCenter.ts index 3715e87f..9bb8e888 100644 --- a/src/api/resources/helpCenter/types/HelpCenter.ts +++ b/src/api/resources/helpCenter/types/HelpCenter.ts @@ -5,21 +5,21 @@ */ export interface HelpCenter { /** The unique identifier for the Help Center which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The id of the workspace which the Help Center belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The time when the Help Center was created. */ - created_at?: number; + created_at?: number | undefined; /** The time when the Help Center was last updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The identifier of the Help Center. This is used in the URL of the Help Center. */ - identifier?: string; + identifier?: string | undefined; /** Whether the Help Center is turned on or not. This is controlled in your Help Center settings. */ - website_turned_on?: boolean; + website_turned_on?: boolean | undefined; /** The display name of the Help Center only seen by teammates. */ - display_name?: string; + display_name?: string | undefined; /** The URL for the help center, if you have a custom domain then this will show the URL using the custom domain. */ - url?: string; + url?: string | undefined; /** Custom domain configured for the help center */ - custom_domain?: string; + custom_domain?: string | undefined; } diff --git a/src/api/resources/helpCenter/types/HelpCenterList.ts b/src/api/resources/helpCenter/types/HelpCenterList.ts index e034eaff..daeabb39 100644 --- a/src/api/resources/helpCenter/types/HelpCenterList.ts +++ b/src/api/resources/helpCenter/types/HelpCenterList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface HelpCenterList { /** The type of the object - `list`. */ - type?: "list"; + type?: "list" | undefined; /** An array of Help Center objects */ - data?: Intercom.HelpCenter[]; + data?: Intercom.HelpCenter[] | undefined; } diff --git a/src/api/resources/helpCenters/client/Client.ts b/src/api/resources/helpCenters/client/Client.ts index 5541fb5c..4874560e 100644 --- a/src/api/resources/helpCenters/client/Client.ts +++ b/src/api/resources/helpCenters/client/Client.ts @@ -11,7 +11,7 @@ import * as Intercom from "../../../index.js"; import { CollectionsClient } from "../resources/collections/client/Client.js"; export declare namespace HelpCentersClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -36,6 +36,8 @@ export class HelpCentersClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.helpCenters.find({ @@ -66,11 +68,11 @@ export class HelpCentersClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/help_centers/${core.url.encodePathParam(helpCenterId)}`, + `help_center/help_centers/${core.url.encodePathParam(helpCenterId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -114,6 +116,8 @@ export class HelpCentersClient { * @param {HelpCentersClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.helpCenters.list() @@ -127,13 +131,10 @@ export class HelpCentersClient { request: Intercom.ListHelpCentersRequest, ): Promise> => { const { page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } + const _queryParams: Record = { + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -150,7 +151,11 @@ export class HelpCentersClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -191,8 +196,15 @@ export class HelpCentersClient { hasNextPage: (response) => (response?.data ?? []).length > 0, getItems: (response) => response?.data ?? [], loadPage: (_response) => { - _offset += 1; - return list(core.setObjectProperty(request, "page", _offset)); + const _nextOffset = _offset + 1; + return core.HttpResponsePromise.fromPromise( + list(core.setObjectProperty(request, "page", _nextOffset)) + .withRawResponse() + .then((_pageResponse) => { + _offset = _nextOffset; + return _pageResponse; + }), + ); }, }); } diff --git a/src/api/resources/helpCenters/exports.ts b/src/api/resources/helpCenters/exports.ts new file mode 100644 index 00000000..50f27b19 --- /dev/null +++ b/src/api/resources/helpCenters/exports.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export { HelpCentersClient } from "./client/Client.js"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/helpCenters/resources/collections/client/Client.ts b/src/api/resources/helpCenters/resources/collections/client/Client.ts index 86958a90..e28908ee 100644 --- a/src/api/resources/helpCenters/resources/collections/client/Client.ts +++ b/src/api/resources/helpCenters/resources/collections/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace CollectionsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +32,8 @@ export class CollectionsClient { * @param {CollectionsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.helpCenters.collections.list() @@ -44,13 +47,10 @@ export class CollectionsClient { request: Intercom.helpCenters.ListCollectionsRequest, ): Promise> => { const { page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } + const _queryParams: Record = { + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -67,7 +67,11 @@ export class CollectionsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -108,8 +112,15 @@ export class CollectionsClient { hasNextPage: (response) => (response?.data ?? []).length > 0, getItems: (response) => response?.data ?? [], loadPage: (_response) => { - _offset += 1; - return list(core.setObjectProperty(request, "page", _offset)); + const _nextOffset = _offset + 1; + return core.HttpResponsePromise.fromPromise( + list(core.setObjectProperty(request, "page", _nextOffset)) + .withRawResponse() + .then((_pageResponse) => { + _offset = _nextOffset; + return _pageResponse; + }), + ); }, }); } @@ -122,6 +133,8 @@ export class CollectionsClient { * * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.helpCenters.collections.create({ @@ -162,9 +175,9 @@ export class CollectionsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -204,6 +217,8 @@ export class CollectionsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.helpCenters.collections.find({ @@ -234,11 +249,11 @@ export class CollectionsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${core.url.encodePathParam(collectionId)}`, + `help_center/collections/${core.url.encodePathParam(collectionId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -283,6 +298,8 @@ export class CollectionsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.helpCenters.collections.update({ @@ -314,14 +331,14 @@ export class CollectionsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${core.url.encodePathParam(collectionId)}`, + `help_center/collections/${core.url.encodePathParam(collectionId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -366,6 +383,8 @@ export class CollectionsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.helpCenters.collections.delete({ @@ -396,11 +415,11 @@ export class CollectionsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${core.url.encodePathParam(collectionId)}`, + `help_center/collections/${core.url.encodePathParam(collectionId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/helpCenters/resources/collections/client/requests/UpdateCollectionRequest.ts b/src/api/resources/helpCenters/resources/collections/client/requests/UpdateCollectionRequest.ts index 63cae012..1164a8e7 100644 --- a/src/api/resources/helpCenters/resources/collections/client/requests/UpdateCollectionRequest.ts +++ b/src/api/resources/helpCenters/resources/collections/client/requests/UpdateCollectionRequest.ts @@ -3,12 +3,6 @@ import type * as Intercom from "../../../../../../index.js"; /** - * @example - * { - * collection_id: 1, - * name: "Update collection name" - * } - * * @example * { * collection_id: 1, diff --git a/src/api/resources/helpCenters/resources/collections/exports.ts b/src/api/resources/helpCenters/resources/collections/exports.ts new file mode 100644 index 00000000..0f865bb1 --- /dev/null +++ b/src/api/resources/helpCenters/resources/collections/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CollectionsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/internalArticles/client/Client.ts b/src/api/resources/internalArticles/client/Client.ts index 4640a818..78f69423 100644 --- a/src/api/resources/internalArticles/client/Client.ts +++ b/src/api/resources/internalArticles/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace InternalArticlesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +32,8 @@ export class InternalArticlesClient { * @param {InternalArticlesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.internalArticles.listInternalArticles() @@ -60,7 +63,7 @@ export class InternalArticlesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -98,6 +101,8 @@ export class InternalArticlesClient { * * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.internalArticles.createInternalArticle({ @@ -143,9 +148,9 @@ export class InternalArticlesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -185,6 +190,8 @@ export class InternalArticlesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.internalArticles.retrieveInternalArticle({ @@ -215,11 +222,11 @@ export class InternalArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `internal_articles/${core.url.encodePathParam(internalArticleId)}`, + `internal_articles/${core.url.encodePathParam(internalArticleId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -264,6 +271,8 @@ export class InternalArticlesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.internalArticles.updateInternalArticle({ @@ -296,14 +305,14 @@ export class InternalArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `internal_articles/${core.url.encodePathParam(internalArticleId)}`, + `internal_articles/${core.url.encodePathParam(internalArticleId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -348,6 +357,8 @@ export class InternalArticlesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.internalArticles.deleteInternalArticle({ @@ -378,11 +389,11 @@ export class InternalArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `internal_articles/${core.url.encodePathParam(internalArticleId)}`, + `internal_articles/${core.url.encodePathParam(internalArticleId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -429,6 +440,8 @@ export class InternalArticlesClient { * @param {InternalArticlesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.internalArticles.searchInternalArticles({ @@ -447,11 +460,9 @@ export class InternalArticlesClient { requestOptions?: InternalArticlesClient.RequestOptions, ): Promise> { const { folder_id: folderId } = request; - const _queryParams: Record = {}; - if (folderId != null) { - _queryParams.folder_id = folderId; - } - + const _queryParams: Record = { + folder_id: folderId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -468,7 +479,11 @@ export class InternalArticlesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts b/src/api/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts index 55416491..7ff47a33 100644 --- a/src/api/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts +++ b/src/api/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts @@ -1,13 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * internal_article_id: 1, - * title: "Christmas is here!", - * body: "

New gifts in store for the jolly season

" - * } - * * @example * { * internal_article_id: 1, diff --git a/src/api/resources/internalArticles/exports.ts b/src/api/resources/internalArticles/exports.ts new file mode 100644 index 00000000..345d0407 --- /dev/null +++ b/src/api/resources/internalArticles/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { InternalArticlesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/internalArticles/types/InternalArticleListItem.ts b/src/api/resources/internalArticles/types/InternalArticleListItem.ts index b906ff6f..8ce1ae40 100644 --- a/src/api/resources/internalArticles/types/InternalArticleListItem.ts +++ b/src/api/resources/internalArticles/types/InternalArticleListItem.ts @@ -5,21 +5,21 @@ */ export interface InternalArticleListItem { /** The type of object - `internal_article`. */ - type?: "internal_article"; + type?: "internal_article" | undefined; /** The unique identifier for the article which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The title of the article. */ - title?: string; + title?: string | undefined; /** The body of the article in HTML. */ - body?: string; + body?: string | undefined; /** The id of the owner of the article. */ - owner_id?: number; + owner_id?: number | undefined; /** The id of the author of the article. */ - author_id?: number; + author_id?: number | undefined; /** The time when the article was created. */ - created_at?: number; + created_at?: number | undefined; /** The time when the article was last updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The default locale of the article. */ - locale?: string; + locale?: string | undefined; } diff --git a/src/api/resources/internalArticles/types/InternalArticleSearchResponse.ts b/src/api/resources/internalArticles/types/InternalArticleSearchResponse.ts index 9718b94b..91c3cce5 100644 --- a/src/api/resources/internalArticles/types/InternalArticleSearchResponse.ts +++ b/src/api/resources/internalArticles/types/InternalArticleSearchResponse.ts @@ -7,12 +7,12 @@ import type * as Intercom from "../../../index.js"; */ export interface InternalArticleSearchResponse { /** The type of the object - `list`. */ - type?: "list"; + type?: "list" | undefined; /** The total number of Internal Articles matching the search query */ - total_count?: number; + total_count?: number | undefined; /** An object containing the results of the search. */ - data?: InternalArticleSearchResponse.Data; - pages?: Intercom.CursorPages; + data?: InternalArticleSearchResponse.Data | undefined; + pages?: Intercom.CursorPages | undefined; } export namespace InternalArticleSearchResponse { @@ -21,6 +21,6 @@ export namespace InternalArticleSearchResponse { */ export interface Data { /** An array of Internal Article objects */ - internal_articles?: Intercom.InternalArticle[]; + internal_articles?: Intercom.InternalArticle[] | undefined; } } diff --git a/src/api/resources/ipAllowlist/client/Client.ts b/src/api/resources/ipAllowlist/client/Client.ts index 21809d4b..d3b456cb 100644 --- a/src/api/resources/ipAllowlist/client/Client.ts +++ b/src/api/resources/ipAllowlist/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace IpAllowlistClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -37,6 +38,8 @@ export class IpAllowlistClient { * @param {IpAllowlistClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ipAllowlist.getIpAllowlist() @@ -66,7 +69,7 @@ export class IpAllowlistClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -108,6 +111,8 @@ export class IpAllowlistClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ipAllowlist.updateIpAllowlist({ @@ -143,9 +148,9 @@ export class IpAllowlistClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/ipAllowlist/exports.ts b/src/api/resources/ipAllowlist/exports.ts new file mode 100644 index 00000000..d58312b3 --- /dev/null +++ b/src/api/resources/ipAllowlist/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { IpAllowlistClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/jobs/client/Client.ts b/src/api/resources/jobs/client/Client.ts index 80585eeb..0cdb5e55 100644 --- a/src/api/resources/jobs/client/Client.ts +++ b/src/api/resources/jobs/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace JobsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +33,8 @@ export class JobsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.jobs.status({ @@ -63,11 +65,11 @@ export class JobsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `jobs/status/${core.url.encodePathParam(jobId)}`, + `jobs/status/${core.url.encodePathParam(jobId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/jobs/exports.ts b/src/api/resources/jobs/exports.ts new file mode 100644 index 00000000..294406a7 --- /dev/null +++ b/src/api/resources/jobs/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { JobsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/jobs/types/Jobs.ts b/src/api/resources/jobs/types/Jobs.ts index c3e63585..7751f1e0 100644 --- a/src/api/resources/jobs/types/Jobs.ts +++ b/src/api/resources/jobs/types/Jobs.ts @@ -5,19 +5,19 @@ */ export interface Jobs { /** The type of the object */ - type?: "job"; + type?: "job" | undefined; /** The id of the job that's currently being processed or has completed. */ id: string; /** API endpoint URL to check the job status. */ - url?: string; + url?: string | undefined; /** The status of the job execution. */ - status?: Jobs.Status; + status?: Jobs.Status | undefined; /** The type of resource created during job execution. */ - resource_type?: string; + resource_type?: string | undefined; /** The id of the resource created during job execution (e.g. ticket id) */ - resource_id?: string; + resource_id?: string | undefined; /** The url of the resource created during job exeuction. Use this url to fetch the resource. */ - resource_url?: string; + resource_url?: string | undefined; } export namespace Jobs { diff --git a/src/api/resources/messages/client/Client.ts b/src/api/resources/messages/client/Client.ts index f4b5d54c..ef9a210c 100644 --- a/src/api/resources/messages/client/Client.ts +++ b/src/api/resources/messages/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace MessagesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -45,6 +46,8 @@ export class MessagesClient { * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.ForbiddenError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.messages.create({ @@ -144,9 +147,9 @@ export class MessagesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/messages/exports.ts b/src/api/resources/messages/exports.ts new file mode 100644 index 00000000..afa2f7cd --- /dev/null +++ b/src/api/resources/messages/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { MessagesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/messages/types/Message.ts b/src/api/resources/messages/types/Message.ts index 2341594c..7d99f07e 100644 --- a/src/api/resources/messages/types/Message.ts +++ b/src/api/resources/messages/types/Message.ts @@ -11,7 +11,7 @@ export interface Message { /** The time the conversation was created. */ created_at: number; /** The subject of the message. Only present if message_type: email. */ - subject?: string; + subject?: string | undefined; /** The message body, which may contain HTML. */ body: string; /** The type of message that was sent. Can be email, inapp, facebook or twitter. */ diff --git a/src/api/resources/news/client/Client.ts b/src/api/resources/news/client/Client.ts index 65efc563..d2a236b8 100644 --- a/src/api/resources/news/client/Client.ts +++ b/src/api/resources/news/client/Client.ts @@ -6,7 +6,7 @@ import { FeedsClient } from "../resources/feeds/client/Client.js"; import { ItemsClient } from "../resources/items/client/Client.js"; export declare namespace NewsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; } export class NewsClient { diff --git a/src/api/resources/news/exports.ts b/src/api/resources/news/exports.ts new file mode 100644 index 00000000..4f877c21 --- /dev/null +++ b/src/api/resources/news/exports.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export { NewsClient } from "./client/Client.js"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/news/resources/feeds/client/Client.ts b/src/api/resources/news/resources/feeds/client/Client.ts index b3c72e7d..8227a2c0 100644 --- a/src/api/resources/news/resources/feeds/client/Client.ts +++ b/src/api/resources/news/resources/feeds/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace FeedsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -29,6 +29,8 @@ export class FeedsClient { * @param {FeedsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.news.feeds.listItems({ @@ -59,11 +61,11 @@ export class FeedsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/newsfeeds/${core.url.encodePathParam(newsfeedId)}/items`, + `news/newsfeeds/${core.url.encodePathParam(newsfeedId, errors.IntercomError)}/items`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -104,6 +106,8 @@ export class FeedsClient { * @param {FeedsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.news.feeds.list() @@ -131,7 +135,7 @@ export class FeedsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -168,6 +172,8 @@ export class FeedsClient { * @param {FeedsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.news.feeds.find({ @@ -198,11 +204,11 @@ export class FeedsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/newsfeeds/${core.url.encodePathParam(newsfeedId)}`, + `news/newsfeeds/${core.url.encodePathParam(newsfeedId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/news/resources/feeds/exports.ts b/src/api/resources/news/resources/feeds/exports.ts new file mode 100644 index 00000000..16e0b9f7 --- /dev/null +++ b/src/api/resources/news/resources/feeds/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { FeedsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/news/resources/items/client/Client.ts b/src/api/resources/news/resources/items/client/Client.ts index 96910a6b..ba579e91 100644 --- a/src/api/resources/news/resources/items/client/Client.ts +++ b/src/api/resources/news/resources/items/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace ItemsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -28,6 +29,8 @@ export class ItemsClient { * @param {ItemsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.news.items.list() @@ -55,7 +58,7 @@ export class ItemsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -92,6 +95,8 @@ export class ItemsClient { * @param {ItemsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.news.items.create({ @@ -136,9 +141,9 @@ export class ItemsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -176,6 +181,8 @@ export class ItemsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.news.items.find({ @@ -206,11 +213,11 @@ export class ItemsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${core.url.encodePathParam(newsItemId)}`, + `news/news_items/${core.url.encodePathParam(newsItemId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -253,6 +260,8 @@ export class ItemsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.news.items.update({ @@ -300,14 +309,14 @@ export class ItemsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${core.url.encodePathParam(newsItemId)}`, + `news/news_items/${core.url.encodePathParam(newsItemId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -352,6 +361,8 @@ export class ItemsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.news.items.delete({ @@ -382,11 +393,11 @@ export class ItemsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${core.url.encodePathParam(newsItemId)}`, + `news/news_items/${core.url.encodePathParam(newsItemId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/news/resources/items/exports.ts b/src/api/resources/news/resources/items/exports.ts new file mode 100644 index 00000000..5b9fe504 --- /dev/null +++ b/src/api/resources/news/resources/items/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ItemsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/news/types/NewsItem.ts b/src/api/resources/news/types/NewsItem.ts index 7ae7b3f9..304a657f 100644 --- a/src/api/resources/news/types/NewsItem.ts +++ b/src/api/resources/news/types/NewsItem.ts @@ -7,33 +7,33 @@ import type * as Intercom from "../../../index.js"; */ export interface NewsItem { /** The type of object. */ - type?: "news-item"; + type?: "news-item" | undefined; /** The unique identifier for the news item which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The id of the workspace which the news item belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The title of the news item. */ - title?: string; + title?: string | undefined; /** The news item body, which may contain HTML. */ - body?: string; + body?: string | undefined; /** The id of the sender of the news item. Must be a teammate on the workspace. */ - sender_id?: number; + sender_id?: number | undefined; /** News items will not be visible to your users in the assigned newsfeeds until they are set live. */ - state?: NewsItem.State; + state?: NewsItem.State | undefined; /** A list of newsfeed_assignments to assign to the specified newsfeed. */ - newsfeed_assignments?: Intercom.NewsfeedAssignment[]; + newsfeed_assignments?: Intercom.NewsfeedAssignment[] | undefined; /** Label names displayed to users to categorize the news item. */ - labels?: (string | undefined)[]; + labels?: (string | undefined)[] | undefined; /** URL of the image used as cover. Must have .jpg or .png extension. */ - cover_image_url?: string; + cover_image_url?: string | undefined; /** Ordered list of emoji reactions to the news item. When empty, reactions are disabled. */ - reactions?: (string | undefined)[]; + reactions?: (string | undefined)[] | undefined; /** When set to true, the news item will appear in the messenger newsfeed without showing a notification badge. */ - deliver_silently?: boolean; + deliver_silently?: boolean | undefined; /** Timestamp for when the news item was created. */ - created_at?: number; + created_at?: number | undefined; /** Timestamp for when the news item was last updated. */ - updated_at?: number; + updated_at?: number | undefined; } export namespace NewsItem { diff --git a/src/api/resources/news/types/Newsfeed.ts b/src/api/resources/news/types/Newsfeed.ts index a42f6306..7a42dee7 100644 --- a/src/api/resources/news/types/Newsfeed.ts +++ b/src/api/resources/news/types/Newsfeed.ts @@ -7,13 +7,13 @@ */ export interface Newsfeed { /** The unique identifier for the newsfeed which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The type of object. */ - type?: "newsfeed"; + type?: "newsfeed" | undefined; /** The name of the newsfeed. This name will never be visible to your users. */ - name?: string; + name?: string | undefined; /** Timestamp for when the newsfeed was created. */ - created_at?: number; + created_at?: number | undefined; /** Timestamp for when the newsfeed was last updated. */ - updated_at?: number; + updated_at?: number | undefined; } diff --git a/src/api/resources/news/types/NewsfeedAssignment.ts b/src/api/resources/news/types/NewsfeedAssignment.ts index 064483c9..5f70a65a 100644 --- a/src/api/resources/news/types/NewsfeedAssignment.ts +++ b/src/api/resources/news/types/NewsfeedAssignment.ts @@ -5,7 +5,7 @@ */ export interface NewsfeedAssignment { /** The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article). */ - newsfeed_id?: number; + newsfeed_id?: number | undefined; /** Publish date of the news item on the newsfeed, use this field if you want to set a publish date in the past (e.g. when importing existing news items). On write, this field will be ignored if the news item state is "draft". */ - published_at?: number; + published_at?: number | undefined; } diff --git a/src/api/resources/notes/client/Client.ts b/src/api/resources/notes/client/Client.ts index da58ae5d..838db58a 100644 --- a/src/api/resources/notes/client/Client.ts +++ b/src/api/resources/notes/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace NotesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +33,8 @@ export class NotesClient { * @param {NotesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.notes.list({ @@ -45,13 +48,10 @@ export class NotesClient { const list = core.HttpResponsePromise.interceptFunction( async (request: Intercom.ListContactNotesRequest): Promise> => { const { contact_id: contactId, page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } + const _queryParams: Record = { + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -64,11 +64,15 @@ export class NotesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/notes`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/notes`, ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -106,8 +110,15 @@ export class NotesClient { hasNextPage: (response) => (response?.data ?? []).length > 0, getItems: (response) => response?.data ?? [], loadPage: (_response) => { - _offset += 1; - return list(core.setObjectProperty(request, "page", _offset)); + const _nextOffset = _offset + 1; + return core.HttpResponsePromise.fromPromise( + list(core.setObjectProperty(request, "page", _nextOffset)) + .withRawResponse() + .then((_pageResponse) => { + _offset = _nextOffset; + return _pageResponse; + }), + ); }, }); } @@ -119,6 +130,8 @@ export class NotesClient { * @param {NotesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.notes.create({ @@ -151,14 +164,14 @@ export class NotesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/notes`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/notes`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -193,6 +206,8 @@ export class NotesClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.notes.find({ @@ -223,11 +238,11 @@ export class NotesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `notes/${core.url.encodePathParam(noteId)}`, + `notes/${core.url.encodePathParam(noteId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/notes/client/requests/CreateContactNoteRequest.ts b/src/api/resources/notes/client/requests/CreateContactNoteRequest.ts index bff219f9..7ec7877f 100644 --- a/src/api/resources/notes/client/requests/CreateContactNoteRequest.ts +++ b/src/api/resources/notes/client/requests/CreateContactNoteRequest.ts @@ -1,20 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * contact_id: "123", - * body: "Hello", - * admin_id: "123" - * } - * - * @example - * { - * contact_id: "123", - * body: "Hello", - * admin_id: "123" - * } - * * @example * { * contact_id: "123", diff --git a/src/api/resources/notes/exports.ts b/src/api/resources/notes/exports.ts new file mode 100644 index 00000000..13f20ba2 --- /dev/null +++ b/src/api/resources/notes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { NotesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/notes/types/Note.ts b/src/api/resources/notes/types/Note.ts index 3ce14629..95006a12 100644 --- a/src/api/resources/notes/types/Note.ts +++ b/src/api/resources/notes/types/Note.ts @@ -13,9 +13,9 @@ export interface Note { /** The time the note was created. */ created_at: number; /** Represents the contact that the note was created about. */ - contact?: Note.Contact; + contact?: Note.Contact | undefined; /** Optional. Represents the Admin that created the note. */ - author?: Intercom.Admin; + author?: Intercom.Admin | undefined; /** The body text of the note. */ body: string; } @@ -26,8 +26,8 @@ export namespace Note { */ export interface Contact { /** String representing the object's type. Always has the value `contact`. */ - type?: string; + type?: string | undefined; /** The id of the contact. */ - id?: string; + id?: string | undefined; } } diff --git a/src/api/resources/phoneCallRedirects/client/Client.ts b/src/api/resources/phoneCallRedirects/client/Client.ts index e2585a9f..d0ea3b82 100644 --- a/src/api/resources/phoneCallRedirects/client/Client.ts +++ b/src/api/resources/phoneCallRedirects/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace PhoneCallRedirectsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -34,6 +35,8 @@ export class PhoneCallRedirectsClient { * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.phoneCallRedirects.create({ @@ -81,9 +84,9 @@ export class PhoneCallRedirectsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/phoneCallRedirects/exports.ts b/src/api/resources/phoneCallRedirects/exports.ts new file mode 100644 index 00000000..16684469 --- /dev/null +++ b/src/api/resources/phoneCallRedirects/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { PhoneCallRedirectsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/segments/client/Client.ts b/src/api/resources/segments/client/Client.ts index d7073779..554d601e 100644 --- a/src/api/resources/segments/client/Client.ts +++ b/src/api/resources/segments/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace SegmentsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +32,8 @@ export class SegmentsClient { * @param {SegmentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.segments.list({ @@ -50,11 +52,9 @@ export class SegmentsClient { requestOptions?: SegmentsClient.RequestOptions, ): Promise> { const { include_count: includeCount } = request; - const _queryParams: Record = {}; - if (includeCount != null) { - _queryParams.include_count = includeCount.toString(); - } - + const _queryParams: Record = { + include_count: includeCount, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -71,7 +71,11 @@ export class SegmentsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -109,6 +113,8 @@ export class SegmentsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.segments.find({ @@ -139,11 +145,11 @@ export class SegmentsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `segments/${core.url.encodePathParam(segmentId)}`, + `segments/${core.url.encodePathParam(segmentId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/segments/exports.ts b/src/api/resources/segments/exports.ts new file mode 100644 index 00000000..c0714387 --- /dev/null +++ b/src/api/resources/segments/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { SegmentsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/segments/types/Segment.ts b/src/api/resources/segments/types/Segment.ts index 5fbb6b53..9a6be1d5 100644 --- a/src/api/resources/segments/types/Segment.ts +++ b/src/api/resources/segments/types/Segment.ts @@ -5,19 +5,19 @@ */ export interface Segment { /** The type of object. */ - type?: "segment"; + type?: "segment" | undefined; /** The unique identifier representing the segment. */ - id?: string; + id?: string | undefined; /** The name of the segment. */ - name?: string; + name?: string | undefined; /** The time the segment was created. */ - created_at?: number; + created_at?: number | undefined; /** The time the segment was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** Type of the contact: contact (lead) or user. */ - person_type?: Segment.PersonType; + person_type?: Segment.PersonType | undefined; /** The number of items in the user segment. It's returned when `include_count=true` is included in the request. */ - count?: number; + count?: number | undefined; } export namespace Segment { diff --git a/src/api/resources/subscriptionTypes/client/Client.ts b/src/api/resources/subscriptionTypes/client/Client.ts index 3f0c2673..777ed59f 100644 --- a/src/api/resources/subscriptionTypes/client/Client.ts +++ b/src/api/resources/subscriptionTypes/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace SubscriptionTypesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +31,8 @@ export class SubscriptionTypesClient { * @param {SubscriptionTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.subscriptionTypes.list() @@ -60,7 +62,7 @@ export class SubscriptionTypesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/subscriptionTypes/exports.ts b/src/api/resources/subscriptionTypes/exports.ts new file mode 100644 index 00000000..92ba3dd0 --- /dev/null +++ b/src/api/resources/subscriptionTypes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { SubscriptionTypesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/subscriptionTypes/types/SubscriptionType.ts b/src/api/resources/subscriptionTypes/types/SubscriptionType.ts index 55372879..4e909c78 100644 --- a/src/api/resources/subscriptionTypes/types/SubscriptionType.ts +++ b/src/api/resources/subscriptionTypes/types/SubscriptionType.ts @@ -7,18 +7,18 @@ import type * as Intercom from "../../../index.js"; */ export interface SubscriptionType { /** The type of the object - subscription */ - type?: "subscription"; + type?: "subscription" | undefined; /** The unique identifier representing the subscription type. */ - id?: string; + id?: string | undefined; /** The state of the subscription type. */ - state?: SubscriptionType.State; - default_translation?: Intercom.Translation; + state?: SubscriptionType.State | undefined; + default_translation?: Intercom.Translation | undefined; /** An array of translations objects with the localised version of the subscription type in each available locale within your translation settings. */ - translations?: Intercom.Translation[]; + translations?: Intercom.Translation[] | undefined; /** Describes the type of consent. */ - consent_type?: SubscriptionType.ConsentType; + consent_type?: SubscriptionType.ConsentType | undefined; /** The message types that this subscription supports - can contain `email` or `sms_message`. */ - content_types?: SubscriptionType.ContentTypes.Item[]; + content_types?: SubscriptionType.ContentTypes.Item[] | undefined; } export namespace SubscriptionType { diff --git a/src/api/resources/tags/client/Client.ts b/src/api/resources/tags/client/Client.ts index 33235bf3..595a3872 100644 --- a/src/api/resources/tags/client/Client.ts +++ b/src/api/resources/tags/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace TagsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +34,8 @@ export class TagsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.tagContact({ @@ -70,14 +73,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/tags`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/tags`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -117,6 +120,8 @@ export class TagsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.untagContact({ @@ -148,11 +153,11 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/tags/${core.url.encodePathParam(tagId)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/tags/${core.url.encodePathParam(tagId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -197,6 +202,8 @@ export class TagsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.tagConversation({ @@ -229,14 +236,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/tags`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/tags`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -281,6 +288,8 @@ export class TagsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.untagConversation({ @@ -313,14 +322,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/tags/${core.url.encodePathParam(tagId)}`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/tags/${core.url.encodePathParam(tagId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -364,6 +373,8 @@ export class TagsClient { * @param {TagsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.list() @@ -389,7 +400,7 @@ export class TagsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -440,6 +451,8 @@ export class TagsClient { * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.create({ @@ -495,9 +508,9 @@ export class TagsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -540,6 +553,8 @@ export class TagsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.find({ @@ -570,11 +585,11 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tags/${core.url.encodePathParam(tagId)}`, + `tags/${core.url.encodePathParam(tagId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -615,6 +630,8 @@ export class TagsClient { * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.delete({ @@ -645,11 +662,11 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tags/${core.url.encodePathParam(tagId)}`, + `tags/${core.url.encodePathParam(tagId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -691,6 +708,8 @@ export class TagsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.tagTicket({ @@ -723,14 +742,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(ticketId)}/tags`, + `tickets/${core.url.encodePathParam(ticketId, errors.IntercomError)}/tags`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -770,6 +789,8 @@ export class TagsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tags.untagTicket({ @@ -802,14 +823,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(ticketId)}/tags/${core.url.encodePathParam(tagId)}`, + `tickets/${core.url.encodePathParam(ticketId, errors.IntercomError)}/tags/${core.url.encodePathParam(tagId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/tags/client/requests/TagContactRequest.ts b/src/api/resources/tags/client/requests/TagContactRequest.ts index a9dd6aa2..2d60591d 100644 --- a/src/api/resources/tags/client/requests/TagContactRequest.ts +++ b/src/api/resources/tags/client/requests/TagContactRequest.ts @@ -10,12 +10,6 @@ * @example * { * contact_id: "63a07ddf05a32042dffac965", - * id: "7522907" - * } - * - * @example - * { - * contact_id: "63a07ddf05a32042dffac965", * id: "123" * } */ diff --git a/src/api/resources/tags/client/requests/TagConversationRequest.ts b/src/api/resources/tags/client/requests/TagConversationRequest.ts index 1a744067..9b53620d 100644 --- a/src/api/resources/tags/client/requests/TagConversationRequest.ts +++ b/src/api/resources/tags/client/requests/TagConversationRequest.ts @@ -1,13 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * conversation_id: "64619700005694", - * id: "7522907", - * admin_id: "780" - * } - * * @example * { * conversation_id: "64619700005694", diff --git a/src/api/resources/tags/client/requests/TagTicketRequest.ts b/src/api/resources/tags/client/requests/TagTicketRequest.ts index 6835d0db..b96635ff 100644 --- a/src/api/resources/tags/client/requests/TagTicketRequest.ts +++ b/src/api/resources/tags/client/requests/TagTicketRequest.ts @@ -1,13 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * ticket_id: "64619700005694", - * id: "7522907", - * admin_id: "780" - * } - * * @example * { * ticket_id: "64619700005694", diff --git a/src/api/resources/tags/client/requests/UntagConversationRequest.ts b/src/api/resources/tags/client/requests/UntagConversationRequest.ts index bcf4e945..8dd63b05 100644 --- a/src/api/resources/tags/client/requests/UntagConversationRequest.ts +++ b/src/api/resources/tags/client/requests/UntagConversationRequest.ts @@ -1,20 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * conversation_id: "64619700005694", - * tag_id: "7522907", - * admin_id: "123" - * } - * - * @example - * { - * conversation_id: "64619700005694", - * tag_id: "7522907", - * admin_id: "123" - * } - * * @example * { * conversation_id: "64619700005694", diff --git a/src/api/resources/tags/client/requests/UntagTicketRequest.ts b/src/api/resources/tags/client/requests/UntagTicketRequest.ts index d6063ea7..9ab44ee4 100644 --- a/src/api/resources/tags/client/requests/UntagTicketRequest.ts +++ b/src/api/resources/tags/client/requests/UntagTicketRequest.ts @@ -1,20 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * ticket_id: "64619700005694", - * tag_id: "7522907", - * admin_id: "123" - * } - * - * @example - * { - * ticket_id: "64619700005694", - * tag_id: "7522907", - * admin_id: "123" - * } - * * @example * { * ticket_id: "64619700005694", diff --git a/src/api/resources/tags/exports.ts b/src/api/resources/tags/exports.ts new file mode 100644 index 00000000..631b2f7d --- /dev/null +++ b/src/api/resources/tags/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TagsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/tags/types/Tag.ts b/src/api/resources/tags/types/Tag.ts index 3a2c7940..ee6669db 100644 --- a/src/api/resources/tags/types/Tag.ts +++ b/src/api/resources/tags/types/Tag.ts @@ -13,6 +13,6 @@ export interface Tag { /** The name of the tag */ name: string; /** The time when the tag was applied to the object */ - applied_at?: number; - applied_by?: Intercom.Reference; + applied_at?: number | undefined; + applied_by?: Intercom.Reference | undefined; } diff --git a/src/api/resources/tags/types/TagBasic.ts b/src/api/resources/tags/types/TagBasic.ts index 8e8b815d..188e9706 100644 --- a/src/api/resources/tags/types/TagBasic.ts +++ b/src/api/resources/tags/types/TagBasic.ts @@ -5,9 +5,9 @@ */ export interface TagBasic { /** value is "tag" */ - type?: string; + type?: string | undefined; /** The id of the tag */ - id?: string; + id?: string | undefined; /** The name of the tag */ - name?: string; + name?: string | undefined; } diff --git a/src/api/resources/teams/client/Client.ts b/src/api/resources/teams/client/Client.ts index 13d8921e..1b64d427 100644 --- a/src/api/resources/teams/client/Client.ts +++ b/src/api/resources/teams/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace TeamsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +31,8 @@ export class TeamsClient { * @param {TeamsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.teams.list() @@ -58,7 +60,7 @@ export class TeamsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -96,6 +98,8 @@ export class TeamsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.teams.find({ @@ -126,11 +130,11 @@ export class TeamsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `teams/${core.url.encodePathParam(teamId)}`, + `teams/${core.url.encodePathParam(teamId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/teams/exports.ts b/src/api/resources/teams/exports.ts new file mode 100644 index 00000000..ca1debc9 --- /dev/null +++ b/src/api/resources/teams/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TeamsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/teams/types/Team.ts b/src/api/resources/teams/types/Team.ts index 8b038649..0924075f 100644 --- a/src/api/resources/teams/types/Team.ts +++ b/src/api/resources/teams/types/Team.ts @@ -7,16 +7,16 @@ import type * as Intercom from "../../../index.js"; */ export interface Team { /** Value is always "team" */ - type?: string; + type?: string | undefined; /** The id of the team */ - id?: string; + id?: string | undefined; /** The name of the team */ - name?: string; + name?: string | undefined; /** The list of admin IDs that are a part of the team. */ - admin_ids?: number[]; - admin_priority_level?: Intercom.AdminPriorityLevel; + admin_ids?: number[] | undefined; + admin_priority_level?: Intercom.AdminPriorityLevel | undefined; /** The assignment limit for the team. This field is only present when the team's distribution type is load balanced. */ - assignment_limit?: number; + assignment_limit?: number | undefined; /** Describes how assignments are distributed among the team members */ - distribution_method?: string; + distribution_method?: string | undefined; } diff --git a/src/api/resources/ticketStates/client/Client.ts b/src/api/resources/ticketStates/client/Client.ts index 58ed8ebf..74a34111 100644 --- a/src/api/resources/ticketStates/client/Client.ts +++ b/src/api/resources/ticketStates/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace TicketStatesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +31,8 @@ export class TicketStatesClient { * @param {TicketStatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ticketStates.listTicketStates() @@ -60,7 +62,7 @@ export class TicketStatesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/ticketStates/exports.ts b/src/api/resources/ticketStates/exports.ts new file mode 100644 index 00000000..cfe67a96 --- /dev/null +++ b/src/api/resources/ticketStates/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TicketStatesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/ticketTypes/client/Client.ts b/src/api/resources/ticketTypes/client/Client.ts index 8649ba80..ecc7f2eb 100644 --- a/src/api/resources/ticketTypes/client/Client.ts +++ b/src/api/resources/ticketTypes/client/Client.ts @@ -4,6 +4,7 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; @@ -11,7 +12,7 @@ import * as Intercom from "../../../index.js"; import { AttributesClient } from "../resources/attributes/client/Client.js"; export declare namespace TicketTypesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -37,6 +38,8 @@ export class TicketTypesClient { * @param {TicketTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ticketTypes.list() @@ -64,7 +67,7 @@ export class TicketTypesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -105,6 +108,8 @@ export class TicketTypesClient { * @param {TicketTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ticketTypes.create({ @@ -142,9 +147,9 @@ export class TicketTypesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -181,6 +186,8 @@ export class TicketTypesClient { * @param {TicketTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ticketTypes.get({ @@ -211,11 +218,11 @@ export class TicketTypesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${core.url.encodePathParam(ticketTypeId)}`, + `ticket_types/${core.url.encodePathParam(ticketTypeId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -262,6 +269,8 @@ export class TicketTypesClient { * @param {TicketTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ticketTypes.update({ @@ -293,14 +302,14 @@ export class TicketTypesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${core.url.encodePathParam(ticketTypeId)}`, + `ticket_types/${core.url.encodePathParam(ticketTypeId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/ticketTypes/client/requests/index.ts b/src/api/resources/ticketTypes/client/requests/index.ts index 8eee27c4..803f7016 100644 --- a/src/api/resources/ticketTypes/client/requests/index.ts +++ b/src/api/resources/ticketTypes/client/requests/index.ts @@ -1,2 +1,2 @@ export type { FindTicketTypeRequest } from "./FindTicketTypeRequest.js"; -export type { UpdateTicketTypeRequest } from "./UpdateTicketTypeRequest.js"; +export { UpdateTicketTypeRequest } from "./UpdateTicketTypeRequest.js"; diff --git a/src/api/resources/ticketTypes/exports.ts b/src/api/resources/ticketTypes/exports.ts new file mode 100644 index 00000000..a1af661a --- /dev/null +++ b/src/api/resources/ticketTypes/exports.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TicketTypesClient } from "./client/Client.js"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/ticketTypes/resources/attributes/client/Client.ts b/src/api/resources/ticketTypes/resources/attributes/client/Client.ts index 0f27dcd1..298df46c 100644 --- a/src/api/resources/ticketTypes/resources/attributes/client/Client.ts +++ b/src/api/resources/ticketTypes/resources/attributes/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace AttributesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -29,6 +30,8 @@ export class AttributesClient { * @param {AttributesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ticketTypes.attributes.create({ @@ -63,14 +66,14 @@ export class AttributesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${core.url.encodePathParam(ticketTypeId)}/attributes`, + `ticket_types/${core.url.encodePathParam(ticketTypeId, errors.IntercomError)}/attributes`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -115,6 +118,8 @@ export class AttributesClient { * @param {AttributesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.ticketTypes.attributes.update({ @@ -147,14 +152,14 @@ export class AttributesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${core.url.encodePathParam(ticketTypeId)}/attributes/${core.url.encodePathParam(attributeId)}`, + `ticket_types/${core.url.encodePathParam(ticketTypeId, errors.IntercomError)}/attributes/${core.url.encodePathParam(attributeId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/ticketTypes/resources/attributes/client/requests/index.ts b/src/api/resources/ticketTypes/resources/attributes/client/requests/index.ts index 2a2ffb63..43a259fb 100644 --- a/src/api/resources/ticketTypes/resources/attributes/client/requests/index.ts +++ b/src/api/resources/ticketTypes/resources/attributes/client/requests/index.ts @@ -1,2 +1,2 @@ -export type { CreateTicketTypeAttributeRequest } from "./CreateTicketTypeAttributeRequest.js"; +export { CreateTicketTypeAttributeRequest } from "./CreateTicketTypeAttributeRequest.js"; export type { UpdateTicketTypeAttributeRequest } from "./UpdateTicketTypeAttributeRequest.js"; diff --git a/src/api/resources/ticketTypes/resources/attributes/exports.ts b/src/api/resources/ticketTypes/resources/attributes/exports.ts new file mode 100644 index 00000000..5fee9ab1 --- /dev/null +++ b/src/api/resources/ticketTypes/resources/attributes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AttributesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/tickets/client/Client.ts b/src/api/resources/tickets/client/Client.ts index d7456f7f..83cc56fa 100644 --- a/src/api/resources/tickets/client/Client.ts +++ b/src/api/resources/tickets/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace TicketsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -34,6 +35,8 @@ export class TicketsClient { * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tickets.reply({ @@ -109,14 +112,14 @@ export class TicketsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(ticketId)}/reply`, + `tickets/${core.url.encodePathParam(ticketId, errors.IntercomError)}/reply`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -157,6 +160,8 @@ export class TicketsClient { * @param {TicketsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tickets.create({ @@ -194,9 +199,9 @@ export class TicketsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -234,6 +239,8 @@ export class TicketsClient { * * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tickets.enqueueCreateTicket({ @@ -271,9 +278,9 @@ export class TicketsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -312,6 +319,8 @@ export class TicketsClient { * @param {TicketsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tickets.get({ @@ -342,11 +351,11 @@ export class TicketsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(ticketId)}`, + `tickets/${core.url.encodePathParam(ticketId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -385,6 +394,8 @@ export class TicketsClient { * @throws {@link Intercom.BadRequestError} * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tickets.update({ @@ -442,14 +453,14 @@ export class TicketsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(ticketId)}`, + `tickets/${core.url.encodePathParam(ticketId, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -491,6 +502,8 @@ export class TicketsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.tickets.deleteTicket({ @@ -521,11 +534,11 @@ export class TicketsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(ticketId)}`, + `tickets/${core.url.encodePathParam(ticketId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -631,6 +644,9 @@ export class TicketsClient { * @param {Intercom.SearchRequest} request * @param {TicketsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.tickets.search({ * query: { @@ -669,9 +685,9 @@ export class TicketsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/tickets/client/requests/ReplyToTicketRequest.ts b/src/api/resources/tickets/client/requests/ReplyToTicketRequest.ts index b67d7011..7d57363d 100644 --- a/src/api/resources/tickets/client/requests/ReplyToTicketRequest.ts +++ b/src/api/resources/tickets/client/requests/ReplyToTicketRequest.ts @@ -52,28 +52,6 @@ import type * as Intercom from "../../../../index.js"; * intercom_user_id: "6762f2a41bb69f9f2193bc4c" * } * } - * - * @example - * { - * ticket_id: "123", - * body: { - * message_type: "comment", - * type: "user", - * body: "Thanks again :)", - * intercom_user_id: "6762f2971bb69f9f2193bc49" - * } - * } - * - * @example - * { - * ticket_id: "123", - * body: { - * message_type: "comment", - * type: "user", - * body: "Thanks again :)", - * intercom_user_id: "6762f2971bb69f9f2193bc49" - * } - * } */ export interface ReplyToTicketRequest { ticket_id: string; diff --git a/src/api/resources/tickets/client/requests/UpdateTicketRequest.ts b/src/api/resources/tickets/client/requests/UpdateTicketRequest.ts index 7ba6219a..5eac72e5 100644 --- a/src/api/resources/tickets/client/requests/UpdateTicketRequest.ts +++ b/src/api/resources/tickets/client/requests/UpdateTicketRequest.ts @@ -30,18 +30,6 @@ * @example * { * ticket_id: "ticket_id", - * ticket_attributes: { - * "_default_title_": "example", - * "_default_description_": "there is a problem" - * }, - * ticket_state_id: "123", - * admin_id: 991268011, - * assignee_id: "123" - * } - * - * @example - * { - * ticket_id: "ticket_id", * ticket_state_id: "123" * } */ diff --git a/src/api/resources/tickets/exports.ts b/src/api/resources/tickets/exports.ts new file mode 100644 index 00000000..6b2593b8 --- /dev/null +++ b/src/api/resources/tickets/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TicketsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/tickets/types/DeleteTicketResponse.ts b/src/api/resources/tickets/types/DeleteTicketResponse.ts index cdad7f2d..a34c0b39 100644 --- a/src/api/resources/tickets/types/DeleteTicketResponse.ts +++ b/src/api/resources/tickets/types/DeleteTicketResponse.ts @@ -5,9 +5,9 @@ */ export interface DeleteTicketResponse { /** The unique identifier for the ticket. */ - id?: string; + id?: string | undefined; /** always ticket */ - object?: "ticket"; + object?: "ticket" | undefined; /** Whether the ticket is deleted or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/tickets/types/Ticket.ts b/src/api/resources/tickets/types/Ticket.ts index 5e686d50..19af4659 100644 --- a/src/api/resources/tickets/types/Ticket.ts +++ b/src/api/resources/tickets/types/Ticket.ts @@ -15,25 +15,25 @@ export interface Ticket { /** Category of the Ticket. */ category: Ticket.Category; ticket_attributes: Intercom.TicketCustomAttributes; - ticket_state?: Intercom.TicketState; - ticket_type?: Intercom.TicketType; + ticket_state?: Intercom.TicketState | undefined; + ticket_type?: Intercom.TicketType | undefined; contacts: Intercom.TicketContacts; /** The id representing the admin assigned to the ticket. */ - admin_assignee_id?: string; + admin_assignee_id?: string | undefined; /** The id representing the team assigned to the ticket. */ - team_assignee_id?: string; + team_assignee_id?: string | undefined; /** The time the ticket was created as a UTC Unix timestamp. */ - created_at?: number; + created_at?: number | undefined; /** The last time the ticket was updated as a UTC Unix timestamp. */ - updated_at?: number; + updated_at?: number | undefined; /** Whether or not the ticket is open. If false, the ticket is closed. */ - open?: boolean; + open?: boolean | undefined; /** The time the ticket will be snoozed until as a UTC Unix timestamp. If null, the ticket is not currently snoozed. */ - snoozed_until?: number; - linked_objects?: Intercom.LinkedObjectList; - ticket_parts?: Intercom.TicketParts; + snoozed_until?: number | undefined; + linked_objects?: Intercom.LinkedObjectList | undefined; + ticket_parts?: Intercom.TicketParts | undefined; /** Whether or not the ticket is shared with the customer. */ - is_shared?: boolean; + is_shared?: boolean | undefined; } export namespace Ticket { diff --git a/src/api/resources/tickets/types/TicketContacts.ts b/src/api/resources/tickets/types/TicketContacts.ts index 1d775525..70e80815 100644 --- a/src/api/resources/tickets/types/TicketContacts.ts +++ b/src/api/resources/tickets/types/TicketContacts.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketContacts { /** always contact.list */ - type?: "contact.list"; + type?: "contact.list" | undefined; /** The list of contacts affected by this ticket. */ - contacts?: Intercom.ContactReference[]; + contacts?: Intercom.ContactReference[] | undefined; } diff --git a/src/api/resources/tickets/types/TicketPart.ts b/src/api/resources/tickets/types/TicketPart.ts index ffe19d95..fc93b09a 100644 --- a/src/api/resources/tickets/types/TicketPart.ts +++ b/src/api/resources/tickets/types/TicketPart.ts @@ -7,34 +7,34 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketPart { /** Always ticket_part */ - type?: string; + type?: string | undefined; /** The id representing the ticket part. */ - id?: string; + id?: string | undefined; /** The type of ticket part. */ - part_type?: string; + part_type?: string | undefined; /** The message body, which may contain HTML. */ - body?: string; + body?: string | undefined; /** The previous state of the ticket. */ - previous_ticket_state?: TicketPart.PreviousTicketState; + previous_ticket_state?: TicketPart.PreviousTicketState | undefined; /** The state of the ticket. */ - ticket_state?: TicketPart.TicketState; + ticket_state?: TicketPart.TicketState | undefined; /** The time the ticket part was created. */ - created_at?: number; + created_at?: number | undefined; /** The last time the ticket part was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.) */ - assigned_to?: Intercom.Reference; - author?: Intercom.TicketPartAuthor; + assigned_to?: Intercom.Reference | undefined; + author?: Intercom.TicketPartAuthor | undefined; /** A list of attachments for the part. */ - attachments?: Intercom.PartAttachment[]; + attachments?: Intercom.PartAttachment[] | undefined; /** The external id of the ticket part */ - external_id?: string; + external_id?: string | undefined; /** Whether or not the ticket part has been redacted. */ - redacted?: boolean; + redacted?: boolean | undefined; /** The app package code if this part was created via API. Note this field won't show if the part was not created via API. */ - app_package_code?: string; + app_package_code?: string | undefined; /** The updated attribute data of the ticket part. Only present for attribute update parts. */ - updated_attribute_data?: TicketPart.UpdatedAttributeData; + updated_attribute_data?: TicketPart.UpdatedAttributeData | undefined; } export namespace TicketPart { diff --git a/src/api/resources/tickets/types/TicketState.ts b/src/api/resources/tickets/types/TicketState.ts index beef89c7..ddd717c1 100644 --- a/src/api/resources/tickets/types/TicketState.ts +++ b/src/api/resources/tickets/types/TicketState.ts @@ -5,15 +5,15 @@ */ export interface TicketState { /** String representing the object's type. Always has the value `ticket_state`. */ - type?: string; + type?: string | undefined; /** The id of the ticket state */ - id?: string; + id?: string | undefined; /** The category of the ticket state */ - category?: TicketState.Category; + category?: TicketState.Category | undefined; /** The state the ticket is currently in, in a human readable form - visible in Intercom */ - internal_label?: string; + internal_label?: string | undefined; /** The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. */ - external_label?: string; + external_label?: string | undefined; } export namespace TicketState { diff --git a/src/api/resources/tickets/types/TicketStateDetailed.ts b/src/api/resources/tickets/types/TicketStateDetailed.ts index df97b118..b3428ed1 100644 --- a/src/api/resources/tickets/types/TicketStateDetailed.ts +++ b/src/api/resources/tickets/types/TicketStateDetailed.ts @@ -7,19 +7,19 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketStateDetailed { /** String representing the object's type. Always has the value `ticket_state`. */ - type?: string; + type?: string | undefined; /** The id of the ticket state */ - id?: string; + id?: string | undefined; /** The category of the ticket state */ - category?: TicketStateDetailed.Category; + category?: TicketStateDetailed.Category | undefined; /** The state the ticket is currently in, in a human readable form - visible in Intercom */ - internal_label?: string; + internal_label?: string | undefined; /** The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. */ - external_label?: string; + external_label?: string | undefined; /** Whether the ticket state is archived */ - archived?: boolean; + archived?: boolean | undefined; /** A list of ticket types associated with a given ticket state. */ - ticket_types?: TicketStateDetailed.TicketTypes; + ticket_types?: TicketStateDetailed.TicketTypes | undefined; } export namespace TicketStateDetailed { @@ -37,8 +37,8 @@ export namespace TicketStateDetailed { */ export interface TicketTypes { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of ticket type attributes associated with a given ticket type. */ - data?: (Intercom.TicketType | undefined)[]; + data?: (Intercom.TicketType | undefined)[] | undefined; } } diff --git a/src/api/resources/tickets/types/TicketType.ts b/src/api/resources/tickets/types/TicketType.ts index 5ad0cd5d..76d35d57 100644 --- a/src/api/resources/tickets/types/TicketType.ts +++ b/src/api/resources/tickets/types/TicketType.ts @@ -7,28 +7,28 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketType { /** String representing the object's type. Always has the value `ticket_type`. */ - type?: string; + type?: string | undefined; /** The id representing the ticket type. */ - id?: string; + id?: string | undefined; /** Category of the Ticket Type. */ - category?: TicketType.Category; + category?: TicketType.Category | undefined; /** The name of the ticket type */ - name?: string; + name?: string | undefined; /** The description of the ticket type */ - description?: string; + description?: string | undefined; /** The icon of the ticket type */ - icon?: string; + icon?: string | undefined; /** The id of the workspace that the ticket type belongs to. */ - workspace_id?: string; - ticket_type_attributes?: Intercom.TicketTypeAttributeList; + workspace_id?: string | undefined; + ticket_type_attributes?: Intercom.TicketTypeAttributeList | undefined; /** A list of ticket states associated with a given ticket type. */ - ticket_states?: TicketType.TicketStates; + ticket_states?: TicketType.TicketStates | undefined; /** Whether the ticket type is archived or not. */ - archived?: boolean; + archived?: boolean | undefined; /** The date and time the ticket type was created. */ - created_at?: number; + created_at?: number | undefined; /** The date and time the ticket type was last updated. */ - updated_at?: number; + updated_at?: number | undefined; } export namespace TicketType { @@ -45,8 +45,8 @@ export namespace TicketType { */ export interface TicketStates { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of ticket states associated with a given ticket type. */ - data?: (Intercom.TicketState | undefined)[]; + data?: (Intercom.TicketState | undefined)[] | undefined; } } diff --git a/src/api/resources/unstable/client/Client.ts b/src/api/resources/unstable/client/Client.ts index f42b2732..aaacb8a9 100644 --- a/src/api/resources/unstable/client/Client.ts +++ b/src/api/resources/unstable/client/Client.ts @@ -38,7 +38,7 @@ import { VisitorsClient } from "../resources/visitors/client/Client.js"; import { WorkflowsClient } from "../resources/workflows/client/Client.js"; export declare namespace UnstableClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; } export class UnstableClient { diff --git a/src/api/resources/unstable/errors/BadRequestError.ts b/src/api/resources/unstable/errors/BadRequestError.ts index 351933dd..830903e2 100644 --- a/src/api/resources/unstable/errors/BadRequestError.ts +++ b/src/api/resources/unstable/errors/BadRequestError.ts @@ -11,6 +11,11 @@ export class BadRequestError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, BadRequestError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "BadRequestError"; } } diff --git a/src/api/resources/unstable/errors/ConflictError.ts b/src/api/resources/unstable/errors/ConflictError.ts index afd826b8..18aeb42d 100644 --- a/src/api/resources/unstable/errors/ConflictError.ts +++ b/src/api/resources/unstable/errors/ConflictError.ts @@ -5,6 +5,8 @@ import * as errors from "../../../../errors/index.js"; import type * as Intercom from "../../../index.js"; export class ConflictError extends errors.IntercomError { + public declare readonly body: Intercom.unstable.Error_; + constructor(body: Intercom.unstable.Error_, rawResponse?: core.RawResponse) { super({ message: "ConflictError", @@ -12,6 +14,11 @@ export class ConflictError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, ConflictError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "ConflictError"; } } diff --git a/src/api/resources/unstable/errors/ForbiddenError.ts b/src/api/resources/unstable/errors/ForbiddenError.ts index a5eefa5f..ab79b8cd 100644 --- a/src/api/resources/unstable/errors/ForbiddenError.ts +++ b/src/api/resources/unstable/errors/ForbiddenError.ts @@ -5,6 +5,8 @@ import * as errors from "../../../../errors/index.js"; import type * as Intercom from "../../../index.js"; export class ForbiddenError extends errors.IntercomError { + public declare readonly body: Intercom.unstable.Error_; + constructor(body: Intercom.unstable.Error_, rawResponse?: core.RawResponse) { super({ message: "ForbiddenError", @@ -12,6 +14,11 @@ export class ForbiddenError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, ForbiddenError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "ForbiddenError"; } } diff --git a/src/api/resources/unstable/errors/InternalServerError.ts b/src/api/resources/unstable/errors/InternalServerError.ts index 05de1b39..47234c26 100644 --- a/src/api/resources/unstable/errors/InternalServerError.ts +++ b/src/api/resources/unstable/errors/InternalServerError.ts @@ -5,6 +5,8 @@ import * as errors from "../../../../errors/index.js"; import type * as Intercom from "../../../index.js"; export class InternalServerError extends errors.IntercomError { + public declare readonly body: Intercom.unstable.Error_; + constructor(body: Intercom.unstable.Error_, rawResponse?: core.RawResponse) { super({ message: "InternalServerError", @@ -12,6 +14,11 @@ export class InternalServerError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, InternalServerError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "InternalServerError"; } } diff --git a/src/api/resources/unstable/errors/NotFoundError.ts b/src/api/resources/unstable/errors/NotFoundError.ts index 2b6a1c39..5d24ba02 100644 --- a/src/api/resources/unstable/errors/NotFoundError.ts +++ b/src/api/resources/unstable/errors/NotFoundError.ts @@ -11,6 +11,11 @@ export class NotFoundError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, NotFoundError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "NotFoundError"; } } diff --git a/src/api/resources/unstable/errors/TooManyRequestsError.ts b/src/api/resources/unstable/errors/TooManyRequestsError.ts index 8213e523..5bb67e0f 100644 --- a/src/api/resources/unstable/errors/TooManyRequestsError.ts +++ b/src/api/resources/unstable/errors/TooManyRequestsError.ts @@ -5,6 +5,8 @@ import * as errors from "../../../../errors/index.js"; import type * as Intercom from "../../../index.js"; export class TooManyRequestsError extends errors.IntercomError { + public declare readonly body: Intercom.unstable.Error_; + constructor(body: Intercom.unstable.Error_, rawResponse?: core.RawResponse) { super({ message: "TooManyRequestsError", @@ -12,6 +14,11 @@ export class TooManyRequestsError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, TooManyRequestsError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "TooManyRequestsError"; } } diff --git a/src/api/resources/unstable/errors/UnauthorizedError.ts b/src/api/resources/unstable/errors/UnauthorizedError.ts index 15ea9d4f..04ddf688 100644 --- a/src/api/resources/unstable/errors/UnauthorizedError.ts +++ b/src/api/resources/unstable/errors/UnauthorizedError.ts @@ -5,6 +5,8 @@ import * as errors from "../../../../errors/index.js"; import type * as Intercom from "../../../index.js"; export class UnauthorizedError extends errors.IntercomError { + public declare readonly body: Intercom.unstable.Error_; + constructor(body: Intercom.unstable.Error_, rawResponse?: core.RawResponse) { super({ message: "UnauthorizedError", @@ -12,6 +14,11 @@ export class UnauthorizedError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, UnauthorizedError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "UnauthorizedError"; } } diff --git a/src/api/resources/unstable/errors/UnprocessableEntityError.ts b/src/api/resources/unstable/errors/UnprocessableEntityError.ts index a2021d64..7c073bd6 100644 --- a/src/api/resources/unstable/errors/UnprocessableEntityError.ts +++ b/src/api/resources/unstable/errors/UnprocessableEntityError.ts @@ -11,6 +11,11 @@ export class UnprocessableEntityError extends errors.IntercomError { body: body, rawResponse: rawResponse, }); - Object.setPrototypeOf(this, UnprocessableEntityError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "UnprocessableEntityError"; } } diff --git a/src/api/resources/unstable/exports.ts b/src/api/resources/unstable/exports.ts new file mode 100644 index 00000000..e39132cc --- /dev/null +++ b/src/api/resources/unstable/exports.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +export { UnstableClient } from "./client/Client.js"; +export * from "./client/index.js"; +export * from "./resources/index.js"; diff --git a/src/api/resources/unstable/resources/admins/client/Client.ts b/src/api/resources/unstable/resources/admins/client/Client.ts index ece2566e..5b47f0bf 100644 --- a/src/api/resources/unstable/resources/admins/client/Client.ts +++ b/src/api/resources/unstable/resources/admins/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace AdminsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -35,6 +36,9 @@ export class AdminsClient { * * @param {AdminsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.admins.identifyAdmin() */ @@ -63,7 +67,7 @@ export class AdminsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -97,6 +101,8 @@ export class AdminsClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.admins.setAwayAdmin({ @@ -137,14 +143,14 @@ export class AdminsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `admins/${core.url.encodePathParam(id)}/away`, + `admins/${core.url.encodePathParam(id, errors.IntercomError)}/away`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -185,6 +191,8 @@ export class AdminsClient { * @param {AdminsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.admins.listActivityLogs({ @@ -204,12 +212,10 @@ export class AdminsClient { requestOptions?: AdminsClient.RequestOptions, ): Promise> { const { created_at_after: createdAtAfter, created_at_before: createdAtBefore } = request; - const _queryParams: Record = {}; - _queryParams.created_at_after = createdAtAfter; - if (createdAtBefore != null) { - _queryParams.created_at_before = createdAtBefore; - } - + const _queryParams: Record = { + created_at_after: createdAtAfter, + created_at_before: createdAtBefore, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -226,7 +232,11 @@ export class AdminsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -262,6 +272,8 @@ export class AdminsClient { * @param {AdminsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.admins.listAdmins() @@ -291,7 +303,7 @@ export class AdminsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -329,6 +341,8 @@ export class AdminsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.admins.retrieveAdmin({ @@ -359,11 +373,11 @@ export class AdminsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `admins/${core.url.encodePathParam(id)}`, + `admins/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/admins/client/requests/SetAwayAdminRequest.ts b/src/api/resources/unstable/resources/admins/client/requests/SetAwayAdminRequest.ts index 7c270dec..0099d315 100644 --- a/src/api/resources/unstable/resources/admins/client/requests/SetAwayAdminRequest.ts +++ b/src/api/resources/unstable/resources/admins/client/requests/SetAwayAdminRequest.ts @@ -15,13 +15,6 @@ * away_mode_enabled: true, * away_mode_reassign: true * } - * - * @example - * { - * id: 1, - * away_mode_enabled: true, - * away_mode_reassign: true - * } */ export interface SetAwayAdminRequest { /** The unique identifier of a given admin */ diff --git a/src/api/resources/unstable/resources/admins/exports.ts b/src/api/resources/unstable/resources/admins/exports.ts new file mode 100644 index 00000000..9d203c17 --- /dev/null +++ b/src/api/resources/unstable/resources/admins/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AdminsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/admins/types/Admin.ts b/src/api/resources/unstable/resources/admins/types/Admin.ts index 113cc504..ba0f8873 100644 --- a/src/api/resources/unstable/resources/admins/types/Admin.ts +++ b/src/api/resources/unstable/resources/admins/types/Admin.ts @@ -7,26 +7,26 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Admin { /** String representing the object's type. Always has the value `admin`. */ - type?: string; + type?: string | undefined; /** The id representing the admin. */ - id?: string; + id?: string | undefined; /** The name of the admin. */ - name?: string; + name?: string | undefined; /** The email of the admin. */ - email?: string; + email?: string | undefined; /** The job title of the admin. */ - job_title?: string; + job_title?: string | undefined; /** Identifies if this admin is currently set in away mode. */ - away_mode_enabled?: boolean; + away_mode_enabled?: boolean | undefined; /** Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. */ - away_mode_reassign?: boolean; + away_mode_reassign?: boolean | undefined; /** The unique identifier of the away status reason */ - away_status_reason_id?: number; + away_status_reason_id?: number | undefined; /** Identifies if this admin has a paid inbox seat to restrict/allow features that require them. */ - has_inbox_seat?: boolean; + has_inbox_seat?: boolean | undefined; /** This object represents the avatar associated with the admin. */ - team_ids?: number[]; + team_ids?: number[] | undefined; /** Image for the associated team or teammate */ - avatar?: string; - team_priority_level?: Intercom.unstable.TeamPriorityLevel; + avatar?: string | undefined; + team_priority_level?: Intercom.unstable.TeamPriorityLevel | undefined; } diff --git a/src/api/resources/unstable/resources/aiAgent/exports.ts b/src/api/resources/unstable/resources/aiAgent/exports.ts new file mode 100644 index 00000000..94d57674 --- /dev/null +++ b/src/api/resources/unstable/resources/aiAgent/exports.ts @@ -0,0 +1,3 @@ +// This file was auto-generated by Fern from our API Definition. + +export * from "./index.js"; diff --git a/src/api/resources/unstable/resources/aiAgent/types/AiAgent.ts b/src/api/resources/unstable/resources/aiAgent/types/AiAgent.ts index 868b1cd9..801ce08b 100644 --- a/src/api/resources/unstable/resources/aiAgent/types/AiAgent.ts +++ b/src/api/resources/unstable/resources/aiAgent/types/AiAgent.ts @@ -7,22 +7,22 @@ import type * as Intercom from "../../../../../index.js"; */ export interface AiAgent { /** The type of the source that triggered AI Agent involvement in the conversation. */ - source_type?: AiAgent.SourceType; + source_type?: AiAgent.SourceType | undefined; /** The title of the source that triggered AI Agent involvement in the conversation. If this is `essentials_plan_setup` then it will return `null`. */ - source_title?: string; + source_title?: string | undefined; /** The type of the last answer delivered by AI Agent. If no answer was delivered then this will return `null` */ - last_answer_type?: AiAgent.LastAnswerType; + last_answer_type?: AiAgent.LastAnswerType | undefined; /** The resolution state of AI Agent. If no AI or custom answer has been delivered then this will return `null`. */ - resolution_state?: AiAgent.ResolutionState; + resolution_state?: AiAgent.ResolutionState | undefined; /** The customer satisfaction rating given to AI Agent, from 1-5. */ - rating?: number; + rating?: number | undefined; /** The customer satisfaction rating remark given to AI Agent. */ - rating_remark?: string; + rating_remark?: string | undefined; /** The time when the AI agent rating was created. */ - created_at?: number; + created_at?: number | undefined; /** The time when the AI agent rating was last updated. */ - updated_at?: number; - content_sources?: Intercom.unstable.ContentSourcesList; + updated_at?: number | undefined; + content_sources?: Intercom.unstable.ContentSourcesList | undefined; } export namespace AiAgent { diff --git a/src/api/resources/unstable/resources/aiContent/client/Client.ts b/src/api/resources/unstable/resources/aiContent/client/Client.ts index cdb6bcae..91d5267a 100644 --- a/src/api/resources/unstable/resources/aiContent/client/Client.ts +++ b/src/api/resources/unstable/resources/aiContent/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace AiContentClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -43,6 +44,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.listContentImportSources() @@ -72,7 +75,7 @@ export class AiContentClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -112,6 +115,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.createContentImportSource({ @@ -146,9 +151,12 @@ export class AiContentClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: { ...request, sync_behavior: "api" }, + body: mergeAdditionalBodyParameters( + { ...request, sync_behavior: "api" }, + requestOptions?.additionalBodyParameters, + ), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -186,6 +194,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.getContentImportSource({ @@ -216,11 +226,11 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/content_import_sources/${core.url.encodePathParam(id)}`, + `ai/content_import_sources/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -265,6 +275,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.updateContentImportSource({ @@ -297,14 +309,14 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/content_import_sources/${core.url.encodePathParam(id)}`, + `ai/content_import_sources/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -349,6 +361,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.deleteContentImportSource({ @@ -379,11 +393,11 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/content_import_sources/${core.url.encodePathParam(id)}`, + `ai/content_import_sources/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -424,6 +438,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.listExternalPages() @@ -453,7 +469,7 @@ export class AiContentClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -490,6 +506,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.createExternalPage({ @@ -528,9 +546,9 @@ export class AiContentClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: { ...request, locale: "en" }, + body: mergeAdditionalBodyParameters({ ...request, locale: "en" }, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -567,6 +585,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.getExternalPage({ @@ -597,11 +617,11 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/external_pages/${core.url.encodePathParam(id)}`, + `ai/external_pages/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -638,6 +658,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.updateExternalPage({ @@ -673,14 +695,14 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/external_pages/${core.url.encodePathParam(id)}`, + `ai/external_pages/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: { ..._body, locale: "en" }, + body: mergeAdditionalBodyParameters({ ..._body, locale: "en" }, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -717,6 +739,8 @@ export class AiContentClient { * @param {AiContentClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.aiContent.deleteExternalPage({ @@ -747,11 +771,11 @@ export class AiContentClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ai/external_pages/${core.url.encodePathParam(id)}`, + `ai/external_pages/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/aiContent/client/requests/index.ts b/src/api/resources/unstable/resources/aiContent/client/requests/index.ts index 2c010829..c6cd1666 100644 --- a/src/api/resources/unstable/resources/aiContent/client/requests/index.ts +++ b/src/api/resources/unstable/resources/aiContent/client/requests/index.ts @@ -1,8 +1,8 @@ -export type { CreateContentImportSourceRequest } from "./CreateContentImportSourceRequest.js"; +export { CreateContentImportSourceRequest } from "./CreateContentImportSourceRequest.js"; export type { CreateExternalPageRequest } from "./CreateExternalPageRequest.js"; export type { DeleteContentImportSourceRequest } from "./DeleteContentImportSourceRequest.js"; export type { DeleteExternalPageRequest } from "./DeleteExternalPageRequest.js"; export type { GetContentImportSourceRequest } from "./GetContentImportSourceRequest.js"; export type { GetExternalPageRequest } from "./GetExternalPageRequest.js"; -export type { UpdateContentImportSourceRequest } from "./UpdateContentImportSourceRequest.js"; +export { UpdateContentImportSourceRequest } from "./UpdateContentImportSourceRequest.js"; export type { UpdateExternalPageRequest } from "./UpdateExternalPageRequest.js"; diff --git a/src/api/resources/unstable/resources/aiContent/exports.ts b/src/api/resources/unstable/resources/aiContent/exports.ts new file mode 100644 index 00000000..e1ce7f43 --- /dev/null +++ b/src/api/resources/unstable/resources/aiContent/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AiContentClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/aiContent/types/ContentImportSourcesList.ts b/src/api/resources/unstable/resources/aiContent/types/ContentImportSourcesList.ts index ca3dfb3a..cb4ad710 100644 --- a/src/api/resources/unstable/resources/aiContent/types/ContentImportSourcesList.ts +++ b/src/api/resources/unstable/resources/aiContent/types/ContentImportSourcesList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../../../index.js"; */ export interface ContentImportSourcesList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.unstable.PagesLink; + type?: "list" | undefined; + pages?: Intercom.unstable.PagesLink | undefined; /** A count of the total number of content import sources. */ - total_count?: number; + total_count?: number | undefined; /** An array of Content Import Source objects */ - data?: Intercom.unstable.ContentImportSource[]; + data?: Intercom.unstable.ContentImportSource[] | undefined; } diff --git a/src/api/resources/unstable/resources/aiContent/types/ExternalPage.ts b/src/api/resources/unstable/resources/aiContent/types/ExternalPage.ts index 97afb31c..9c7b614c 100644 --- a/src/api/resources/unstable/resources/aiContent/types/ExternalPage.ts +++ b/src/api/resources/unstable/resources/aiContent/types/ExternalPage.ts @@ -13,13 +13,13 @@ export interface ExternalPage { /** The body of the external page in HTML. */ html: string; /** The URL of the external page. This will be used by Fin to link end users to the page it based its answer on. */ - url?: string; + url?: string | undefined; /** Whether the external page should be used to answer questions by AI Agent. */ ai_agent_availability: boolean; /** Whether the external page should be used to answer questions by AI Copilot. */ ai_copilot_availability: boolean; /** Deprecated. Use ai_agent_availability and ai_copilot_availability instead. */ - fin_availability?: boolean; + fin_availability?: boolean | undefined; /** Always en */ locale: "en"; /** The unique identifier for the source of the external page which was given by Intercom. Every external page must be associated with a Content Import Source which represents the place it comes from and from which it inherits a default audience (configured in the UI). For a new source, make a POST request to the Content Import Source endpoint and an ID for the source will be returned in the response. */ diff --git a/src/api/resources/unstable/resources/aiContent/types/ExternalPagesList.ts b/src/api/resources/unstable/resources/aiContent/types/ExternalPagesList.ts index 94172e4f..b7fa9c9e 100644 --- a/src/api/resources/unstable/resources/aiContent/types/ExternalPagesList.ts +++ b/src/api/resources/unstable/resources/aiContent/types/ExternalPagesList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../../../index.js"; */ export interface ExternalPagesList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.unstable.PagesLink; + type?: "list" | undefined; + pages?: Intercom.unstable.PagesLink | undefined; /** A count of the total number of external pages. */ - total_count?: number; + total_count?: number | undefined; /** An array of External Page objects */ - data?: Intercom.unstable.ExternalPage[]; + data?: Intercom.unstable.ExternalPage[] | undefined; } diff --git a/src/api/resources/unstable/resources/aiContentSource/exports.ts b/src/api/resources/unstable/resources/aiContentSource/exports.ts new file mode 100644 index 00000000..94d57674 --- /dev/null +++ b/src/api/resources/unstable/resources/aiContentSource/exports.ts @@ -0,0 +1,3 @@ +// This file was auto-generated by Fern from our API Definition. + +export * from "./index.js"; diff --git a/src/api/resources/unstable/resources/aiContentSource/types/ContentSource.ts b/src/api/resources/unstable/resources/aiContentSource/types/ContentSource.ts index 9b504015..c82d5a44 100644 --- a/src/api/resources/unstable/resources/aiContentSource/types/ContentSource.ts +++ b/src/api/resources/unstable/resources/aiContentSource/types/ContentSource.ts @@ -5,13 +5,13 @@ */ export interface ContentSource { /** The type of the content source. */ - content_type?: ContentSource.ContentType; + content_type?: ContentSource.ContentType | undefined; /** The internal URL linking to the content source for teammates. */ - url?: string; + url?: string | undefined; /** The title of the content source. */ - title?: string; + title?: string | undefined; /** The ISO 639 language code of the content source. */ - locale?: string; + locale?: string | undefined; } export namespace ContentSource { diff --git a/src/api/resources/unstable/resources/articles/client/Client.ts b/src/api/resources/unstable/resources/articles/client/Client.ts index 5ab11f3e..fee01d78 100644 --- a/src/api/resources/unstable/resources/articles/client/Client.ts +++ b/src/api/resources/unstable/resources/articles/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace ArticlesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -35,6 +36,8 @@ export class ArticlesClient { * @param {ArticlesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.articles.listArticles() @@ -64,7 +67,7 @@ export class ArticlesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -102,6 +105,8 @@ export class ArticlesClient { * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.articles.createArticle({ @@ -136,9 +141,9 @@ export class ArticlesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -178,6 +183,8 @@ export class ArticlesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.articles.retrieveArticle({ @@ -208,11 +215,11 @@ export class ArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `articles/${core.url.encodePathParam(id)}`, + `articles/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -252,6 +259,8 @@ export class ArticlesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.articles.deleteArticle({ @@ -282,11 +291,11 @@ export class ArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `articles/${core.url.encodePathParam(id)}`, + `articles/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -328,6 +337,8 @@ export class ArticlesClient { * @param {ArticlesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.articles.searchArticles({ @@ -349,23 +360,12 @@ export class ArticlesClient { requestOptions?: ArticlesClient.RequestOptions, ): Promise> { const { phrase, state, help_center_id: helpCenterId, highlight } = request; - const _queryParams: Record = {}; - if (phrase != null) { - _queryParams.phrase = phrase; - } - - if (state != null) { - _queryParams.state = state; - } - - if (helpCenterId != null) { - _queryParams.help_center_id = helpCenterId.toString(); - } - - if (highlight != null) { - _queryParams.highlight = highlight.toString(); - } - + const _queryParams: Record = { + phrase, + state, + help_center_id: helpCenterId, + highlight, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -382,7 +382,11 @@ export class ArticlesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/articles/exports.ts b/src/api/resources/unstable/resources/articles/exports.ts new file mode 100644 index 00000000..9332773b --- /dev/null +++ b/src/api/resources/unstable/resources/articles/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ArticlesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/articles/types/Article.ts b/src/api/resources/unstable/resources/articles/types/Article.ts index cab08a5d..076e97b1 100644 --- a/src/api/resources/unstable/resources/articles/types/Article.ts +++ b/src/api/resources/unstable/resources/articles/types/Article.ts @@ -6,5 +6,5 @@ import type * as Intercom from "../../../../../index.js"; * The Articles API is a central place to gather all information and take actions on your articles. Articles can live within collections and sections, or alternatively they can stand alone. */ export interface Article extends Intercom.unstable.ArticleListItem { - statistics?: Intercom.unstable.ArticleStatistics; + statistics?: Intercom.unstable.ArticleStatistics | undefined; } diff --git a/src/api/resources/unstable/resources/articles/types/ArticleListItem.ts b/src/api/resources/unstable/resources/articles/types/ArticleListItem.ts index 9c33e430..98b08323 100644 --- a/src/api/resources/unstable/resources/articles/types/ArticleListItem.ts +++ b/src/api/resources/unstable/resources/articles/types/ArticleListItem.ts @@ -7,36 +7,36 @@ import type * as Intercom from "../../../../../index.js"; */ export interface ArticleListItem { /** The type of object - `article`. */ - type?: "article"; + type?: "article" | undefined; /** The unique identifier for the article which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The id of the workspace which the article belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The title of the article. For multilingual articles, this will be the title of the default language's content. */ - title?: string; + title?: string | undefined; /** The description of the article. For multilingual articles, this will be the description of the default language's content. */ - description?: string; + description?: string | undefined; /** The body of the article in HTML. For multilingual articles, this will be the body of the default language's content. */ - body?: string; + body?: string | undefined; /** The id of the author of the article. For multilingual articles, this will be the id of the author of the default language's content. Must be a teammate on the help center's workspace. */ - author_id?: number; + author_id?: number | undefined; /** Whether the article is `published` or is a `draft`. For multilingual articles, this will be the state of the default language's content. */ - state?: ArticleListItem.State; + state?: ArticleListItem.State | undefined; /** The time when the article was created. For multilingual articles, this will be the timestamp of creation of the default language's content in seconds. */ - created_at?: number; + created_at?: number | undefined; /** The time when the article was last updated. For multilingual articles, this will be the timestamp of last update of the default language's content in seconds. */ - updated_at?: number; + updated_at?: number | undefined; /** The URL of the article. For multilingual articles, this will be the URL of the default language's content. */ - url?: string; + url?: string | undefined; /** The id of the article's parent collection or section. An article without this field stands alone. */ - parent_id?: number; + parent_id?: number | undefined; /** The ids of the article's parent collections or sections. An article without this field stands alone. */ - parent_ids?: number[]; + parent_ids?: number[] | undefined; /** The type of parent, which can either be a `collection` or `section`. */ - parent_type?: string; + parent_type?: string | undefined; /** The default locale of the help center. This field is only returned for multilingual help centers. */ - default_locale?: string; - translated_content?: Intercom.unstable.ArticleTranslatedContent; + default_locale?: string | undefined; + translated_content?: Intercom.unstable.ArticleTranslatedContent | undefined; } export namespace ArticleListItem { diff --git a/src/api/resources/unstable/resources/articles/types/ArticleSearchHighlights.ts b/src/api/resources/unstable/resources/articles/types/ArticleSearchHighlights.ts index c80f22fa..d121c6b0 100644 --- a/src/api/resources/unstable/resources/articles/types/ArticleSearchHighlights.ts +++ b/src/api/resources/unstable/resources/articles/types/ArticleSearchHighlights.ts @@ -5,11 +5,11 @@ */ export interface ArticleSearchHighlights { /** The ID of the corresponding article. */ - article_id?: string; + article_id?: string | undefined; /** An Article title highlighted. */ - highlighted_title?: ArticleSearchHighlights.HighlightedTitle.Item[]; + highlighted_title?: ArticleSearchHighlights.HighlightedTitle.Item[] | undefined; /** An Article description and body text highlighted. */ - highlighted_summary?: ArticleSearchHighlights.HighlightedSummary.Item[][]; + highlighted_summary?: ArticleSearchHighlights.HighlightedSummary.Item[][] | undefined; } export namespace ArticleSearchHighlights { @@ -21,9 +21,9 @@ export namespace ArticleSearchHighlights { */ export interface Item { /** The type of text - `highlight` or `plain`. */ - type?: Item.Type; + type?: Item.Type | undefined; /** The text of the title. */ - text?: string; + text?: string | undefined; } export namespace Item { @@ -44,9 +44,9 @@ export namespace ArticleSearchHighlights { */ export interface Item { /** The type of text - `highlight` or `plain`. */ - type?: Item.Type; + type?: Item.Type | undefined; /** The text of the title. */ - text?: string; + text?: string | undefined; } export namespace Item { diff --git a/src/api/resources/unstable/resources/articles/types/ArticleSearchResponse.ts b/src/api/resources/unstable/resources/articles/types/ArticleSearchResponse.ts index 71b72609..ad9ee383 100644 --- a/src/api/resources/unstable/resources/articles/types/ArticleSearchResponse.ts +++ b/src/api/resources/unstable/resources/articles/types/ArticleSearchResponse.ts @@ -7,12 +7,12 @@ import type * as Intercom from "../../../../../index.js"; */ export interface ArticleSearchResponse { /** The type of the object - `list`. */ - type?: "list"; + type?: "list" | undefined; /** The total number of Articles matching the search query */ - total_count?: number; + total_count?: number | undefined; /** An object containing the results of the search. */ - data?: ArticleSearchResponse.Data; - pages?: Intercom.unstable.CursorPages; + data?: ArticleSearchResponse.Data | undefined; + pages?: Intercom.unstable.CursorPages | undefined; } export namespace ArticleSearchResponse { @@ -21,8 +21,8 @@ export namespace ArticleSearchResponse { */ export interface Data { /** An array of Article objects */ - articles?: Intercom.unstable.Article[]; + articles?: Intercom.unstable.Article[] | undefined; /** A corresponding array of highlighted Article content */ - highlights?: Intercom.unstable.ArticleSearchHighlights[]; + highlights?: Intercom.unstable.ArticleSearchHighlights[] | undefined; } } diff --git a/src/api/resources/unstable/resources/awayStatusReasons/client/Client.ts b/src/api/resources/unstable/resources/awayStatusReasons/client/Client.ts index 5be942d3..f2cb1ed5 100644 --- a/src/api/resources/unstable/resources/awayStatusReasons/client/Client.ts +++ b/src/api/resources/unstable/resources/awayStatusReasons/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace AwayStatusReasonsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +31,8 @@ export class AwayStatusReasonsClient { * @param {AwayStatusReasonsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.awayStatusReasons.listAwayStatusReasons() @@ -60,7 +62,7 @@ export class AwayStatusReasonsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/awayStatusReasons/exports.ts b/src/api/resources/unstable/resources/awayStatusReasons/exports.ts new file mode 100644 index 00000000..8bd32934 --- /dev/null +++ b/src/api/resources/unstable/resources/awayStatusReasons/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { AwayStatusReasonsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/brands/client/Client.ts b/src/api/resources/unstable/resources/brands/client/Client.ts index 29540dc4..37c23710 100644 --- a/src/api/resources/unstable/resources/brands/client/Client.ts +++ b/src/api/resources/unstable/resources/brands/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace BrandsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +32,8 @@ export class BrandsClient { * @param {BrandsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.brands.listBrands() @@ -61,7 +63,7 @@ export class BrandsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -99,6 +101,8 @@ export class BrandsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.brands.retrieveBrand({ @@ -129,11 +133,11 @@ export class BrandsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `brands/${core.url.encodePathParam(id)}`, + `brands/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/brands/exports.ts b/src/api/resources/unstable/resources/brands/exports.ts new file mode 100644 index 00000000..e7adbf60 --- /dev/null +++ b/src/api/resources/unstable/resources/brands/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { BrandsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/brands/types/Brand.ts b/src/api/resources/unstable/resources/brands/types/Brand.ts index 53a416af..7d2a49a9 100644 --- a/src/api/resources/unstable/resources/brands/types/Brand.ts +++ b/src/api/resources/unstable/resources/brands/types/Brand.ts @@ -5,19 +5,19 @@ */ export interface Brand { /** The type of object */ - type?: string; + type?: string | undefined; /** Unique brand identifier. For default brand, matches the workspace ID */ - id?: string; + id?: string | undefined; /** Display name of the brand */ - name?: string; + name?: string | undefined; /** Whether this is the workspace's default brand */ - is_default?: boolean; + is_default?: boolean | undefined; /** Unix timestamp of brand creation */ - created_at?: number; + created_at?: number | undefined; /** Unix timestamp of last modification */ - updated_at?: number; + updated_at?: number | undefined; /** Associated help center identifier */ - help_center_id?: string; + help_center_id?: string | undefined; /** Default email settings ID for this brand */ - default_address_settings_id?: string; + default_address_settings_id?: string | undefined; } diff --git a/src/api/resources/unstable/resources/brands/types/BrandList.ts b/src/api/resources/unstable/resources/brands/types/BrandList.ts index 3d7330de..4baf79ac 100644 --- a/src/api/resources/unstable/resources/brands/types/BrandList.ts +++ b/src/api/resources/unstable/resources/brands/types/BrandList.ts @@ -7,6 +7,6 @@ import type * as Intercom from "../../../../../index.js"; */ export interface BrandList { /** The type of object */ - type?: string; - data?: Intercom.unstable.Brand[]; + type?: string | undefined; + data?: Intercom.unstable.Brand[] | undefined; } diff --git a/src/api/resources/unstable/resources/calls/client/Client.ts b/src/api/resources/unstable/resources/calls/client/Client.ts index 24f1b6f6..b6ebbd95 100644 --- a/src/api/resources/unstable/resources/calls/client/Client.ts +++ b/src/api/resources/unstable/resources/calls/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace CallsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +33,8 @@ export class CallsClient { * @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.listCalls({ @@ -51,15 +54,10 @@ export class CallsClient { requestOptions?: CallsClient.RequestOptions, ): Promise> { const { page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - + const _queryParams: Record = { + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -76,7 +74,11 @@ export class CallsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -114,6 +116,8 @@ export class CallsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.showCall({ @@ -144,11 +148,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `calls/${core.url.encodePathParam(id)}`, + `calls/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -188,6 +192,8 @@ export class CallsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.showCallRecording({ @@ -218,11 +224,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `calls/${core.url.encodePathParam(id)}/recording`, + `calls/${core.url.encodePathParam(id, errors.IntercomError)}/recording`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -261,6 +267,8 @@ export class CallsClient { * @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.showCallTranscript({ @@ -291,11 +299,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `calls/${core.url.encodePathParam(id)}/transcript`, + `calls/${core.url.encodePathParam(id, errors.IntercomError)}/transcript`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), responseType: "text", timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, @@ -332,6 +340,8 @@ export class CallsClient { * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.listCallsWithTranscripts({ @@ -366,9 +376,9 @@ export class CallsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -417,6 +427,8 @@ export class CallsClient { * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.ConflictError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.registerFinVoiceCall({ @@ -452,9 +464,9 @@ export class CallsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -493,6 +505,8 @@ export class CallsClient { * @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.collectFinVoiceCallById({ @@ -523,11 +537,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `fin_voice/collect/${core.url.encodePathParam(id)}`, + `fin_voice/collect/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -561,6 +575,8 @@ export class CallsClient { * @param {CallsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.collectFinVoiceCallByExternalId({ @@ -591,11 +607,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `fin_voice/external_id/${core.url.encodePathParam(externalId)}`, + `fin_voice/external_id/${core.url.encodePathParam(externalId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -637,6 +653,8 @@ export class CallsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.calls.collectFinVoiceCallByPhoneNumber({ @@ -667,11 +685,11 @@ export class CallsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `fin_voice/phone_number/${core.url.encodePathParam(phoneNumber)}`, + `fin_voice/phone_number/${core.url.encodePathParam(phoneNumber, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/calls/exports.ts b/src/api/resources/unstable/resources/calls/exports.ts new file mode 100644 index 00000000..e77f47c9 --- /dev/null +++ b/src/api/resources/unstable/resources/calls/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CallsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/calls/types/Call.ts b/src/api/resources/unstable/resources/calls/types/Call.ts index 18bb1be3..8f9eb2ed 100644 --- a/src/api/resources/unstable/resources/calls/types/Call.ts +++ b/src/api/resources/unstable/resources/calls/types/Call.ts @@ -7,36 +7,36 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Call { /** String representing the object's type. Always has the value `call`. */ - type?: string; + type?: string | undefined; /** The id of the call. */ - id?: string; + id?: string | undefined; /** The id of the conversation associated with the call, if any. */ - conversation_id?: string; + conversation_id?: string | undefined; /** The id of the admin associated with the call, if any. */ - admin_id?: string; + admin_id?: string | undefined; /** The id of the contact associated with the call, if any. */ - contact_id?: string; + contact_id?: string | undefined; /** The current state of the call. */ - state?: string; - initiated_at?: Intercom.unstable.Datetime; - answered_at?: Intercom.unstable.Datetime; - ended_at?: Intercom.unstable.Datetime; - created_at?: Intercom.unstable.Datetime; - updated_at?: Intercom.unstable.Datetime; + state?: string | undefined; + initiated_at?: Intercom.unstable.Datetime | undefined; + answered_at?: Intercom.unstable.Datetime | undefined; + ended_at?: Intercom.unstable.Datetime | undefined; + created_at?: Intercom.unstable.Datetime | undefined; + updated_at?: Intercom.unstable.Datetime | undefined; /** API URL to download or redirect to the call recording if available. */ - recording_url?: string; + recording_url?: string | undefined; /** API URL to the call transcript if available. */ - transcription_url?: string; + transcription_url?: string | undefined; /** The type of call. */ - call_type?: string; + call_type?: string | undefined; /** The direction of the call. */ - direction?: string; + direction?: string | undefined; /** The reason for the call end, if applicable. */ - ended_reason?: string; + ended_reason?: string | undefined; /** The phone number involved in the call, in E.164 format. */ - phone?: string; + phone?: string | undefined; /** API URL to the AI Agent (Fin) call recording if available. */ - fin_recording_url?: string; + fin_recording_url?: string | undefined; /** API URL to the AI Agent (Fin) call transcript if available. */ - fin_transcription_url?: string; + fin_transcription_url?: string | undefined; } diff --git a/src/api/resources/unstable/resources/calls/types/ListCallsWithTranscriptsResponse.ts b/src/api/resources/unstable/resources/calls/types/ListCallsWithTranscriptsResponse.ts index ec066741..8031748c 100644 --- a/src/api/resources/unstable/resources/calls/types/ListCallsWithTranscriptsResponse.ts +++ b/src/api/resources/unstable/resources/calls/types/ListCallsWithTranscriptsResponse.ts @@ -3,8 +3,8 @@ import type * as Intercom from "../../../../../index.js"; export interface ListCallsWithTranscriptsResponse { - type?: string; - data?: ListCallsWithTranscriptsResponse.Data.Item[]; + type?: string | undefined; + data?: ListCallsWithTranscriptsResponse.Data.Item[] | undefined; } export namespace ListCallsWithTranscriptsResponse { @@ -13,9 +13,9 @@ export namespace ListCallsWithTranscriptsResponse { export namespace Data { export interface Item extends Intercom.unstable.Call { /** The call transcript if available, otherwise an empty array. */ - transcript?: Record[]; + transcript?: Record[] | undefined; /** The status of the transcript if available. */ - transcript_status?: string; + transcript_status?: string | undefined; } } } diff --git a/src/api/resources/unstable/resources/companies/client/Client.ts b/src/api/resources/unstable/resources/companies/client/Client.ts index 575c345d..5191b35b 100644 --- a/src/api/resources/unstable/resources/companies/client/Client.ts +++ b/src/api/resources/unstable/resources/companies/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace CompaniesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -43,6 +44,8 @@ export class CompaniesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.retrieveCompany({ @@ -66,31 +69,14 @@ export class CompaniesClient { requestOptions?: CompaniesClient.RequestOptions, ): Promise> { const { name, company_id: companyId, tag_id: tagId, segment_id: segmentId, page, per_page: perPage } = request; - const _queryParams: Record = {}; - if (name != null) { - _queryParams.name = name; - } - - if (companyId != null) { - _queryParams.company_id = companyId; - } - - if (tagId != null) { - _queryParams.tag_id = tagId; - } - - if (segmentId != null) { - _queryParams.segment_id = segmentId; - } - - if (page != null) { - _queryParams.page = page.toString(); - } - - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - + const _queryParams: Record = { + name, + company_id: companyId, + tag_id: tagId, + segment_id: segmentId, + page, + per_page: perPage, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -107,7 +93,11 @@ export class CompaniesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -155,6 +145,8 @@ export class CompaniesClient { * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.createOrUpdateCompany({ @@ -189,9 +181,9 @@ export class CompaniesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -231,6 +223,8 @@ export class CompaniesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.retrieveACompanyById({ @@ -261,11 +255,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(id)}`, + `companies/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -309,6 +303,8 @@ export class CompaniesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.updateCompany({ @@ -339,11 +335,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(id)}`, + `companies/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -383,6 +379,8 @@ export class CompaniesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.deleteCompany({ @@ -413,11 +411,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(id)}`, + `companies/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -460,6 +458,8 @@ export class CompaniesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.listAttachedContacts({ @@ -490,11 +490,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(id)}/contacts`, + `companies/${core.url.encodePathParam(id, errors.IntercomError)}/contacts`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -537,6 +537,8 @@ export class CompaniesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.listAttachedSegmentsForCompanies({ @@ -567,11 +569,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(id)}/segments`, + `companies/${core.url.encodePathParam(id, errors.IntercomError)}/segments`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -621,6 +623,8 @@ export class CompaniesClient { * @param {CompaniesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.listAllCompanies({ @@ -641,19 +645,11 @@ export class CompaniesClient { requestOptions?: CompaniesClient.RequestOptions, ): Promise> { const { page, per_page: perPage, order } = request; - const _queryParams: Record = {}; - if (page != null) { - _queryParams.page = page.toString(); - } - - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - - if (order != null) { - _queryParams.order = order; - } - + const _queryParams: Record = { + page, + per_page: perPage, + order, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -670,7 +666,11 @@ export class CompaniesClient { ), method: "POST", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -721,6 +721,8 @@ export class CompaniesClient { * @param {CompaniesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.scrollOverAllCompanies({ @@ -739,11 +741,9 @@ export class CompaniesClient { requestOptions?: CompaniesClient.RequestOptions, ): Promise> { const { scroll_param: scrollParam } = request; - const _queryParams: Record = {}; - if (scrollParam != null) { - _queryParams.scroll_param = scrollParam; - } - + const _queryParams: Record = { + scroll_param: scrollParam, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -760,7 +760,11 @@ export class CompaniesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -802,6 +806,8 @@ export class CompaniesClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.attachContactToACompany({ @@ -845,14 +851,14 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}/companies`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}/companies`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -894,6 +900,8 @@ export class CompaniesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.companies.detachContactFromACompany({ @@ -925,11 +933,11 @@ export class CompaniesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/companies/${core.url.encodePathParam(id)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/companies/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/companies/client/requests/ScrollOverAllCompaniesRequest.ts b/src/api/resources/unstable/resources/companies/client/requests/ScrollOverAllCompaniesRequest.ts index 68f2ed8b..be05733f 100644 --- a/src/api/resources/unstable/resources/companies/client/requests/ScrollOverAllCompaniesRequest.ts +++ b/src/api/resources/unstable/resources/companies/client/requests/ScrollOverAllCompaniesRequest.ts @@ -7,6 +7,5 @@ * } */ export interface ScrollOverAllCompaniesRequest { - /** */ scroll_param?: string; } diff --git a/src/api/resources/unstable/resources/companies/exports.ts b/src/api/resources/unstable/resources/companies/exports.ts new file mode 100644 index 00000000..2ca4d184 --- /dev/null +++ b/src/api/resources/unstable/resources/companies/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CompaniesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/companies/types/Company.ts b/src/api/resources/unstable/resources/companies/types/Company.ts index d2569495..b7fac1f6 100644 --- a/src/api/resources/unstable/resources/companies/types/Company.ts +++ b/src/api/resources/unstable/resources/companies/types/Company.ts @@ -7,54 +7,54 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Company { /** Value is `company` */ - type?: "company"; + type?: "company" | undefined; /** The Intercom defined id representing the company. */ - id?: string; + id?: string | undefined; /** The name of the company. */ - name?: string; + name?: string | undefined; /** The Intercom defined code of the workspace the company is associated to. */ - app_id?: string; - plan?: Company.Plan; + app_id?: string | undefined; + plan?: Company.Plan | undefined; /** The company id you have defined for the company. */ - company_id?: string; + company_id?: string | undefined; /** The time the company was created by you. */ - remote_created_at?: number; + remote_created_at?: number | undefined; /** The time the company was added in Intercom. */ - created_at?: number; + created_at?: number | undefined; /** The last time the company was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The time the company last recorded making a request. */ - last_request_at?: number; + last_request_at?: number | undefined; /** The number of employees in the company. */ - size?: number; + size?: number | undefined; /** The URL for the company website. */ - website?: string; + website?: string | undefined; /** The industry that the company operates in. */ - industry?: string; + industry?: string | undefined; /** How much revenue the company generates for your business. */ - monthly_spend?: number; + monthly_spend?: number | undefined; /** How many sessions the company has recorded. */ - session_count?: number; + session_count?: number | undefined; /** The number of users in the company. */ - user_count?: number; + user_count?: number | undefined; /** The custom attributes you have set on the company. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; /** The list of tags associated with the company */ - tags?: Company.Tags; + tags?: Company.Tags | undefined; /** The list of segments associated with the company */ - segments?: Company.Segments; + segments?: Company.Segments | undefined; /** The list of notes associated with the company */ - notes?: Company.Notes; + notes?: Company.Notes | undefined; } export namespace Company { export interface Plan { /** Value is always "plan" */ - type?: string; + type?: string | undefined; /** The id of the plan */ - id?: string; + id?: string | undefined; /** The name of the plan */ - name?: string; + name?: string | undefined; } /** @@ -62,8 +62,8 @@ export namespace Company { */ export interface Tags { /** The type of the object */ - type?: "tag.list"; - tags?: unknown[]; + type?: "tag.list" | undefined; + tags?: unknown[] | undefined; } /** @@ -71,8 +71,8 @@ export namespace Company { */ export interface Segments { /** The type of the object */ - type?: "segment.list"; - segments?: Intercom.unstable.Segment[]; + type?: "segment.list" | undefined; + segments?: Intercom.unstable.Segment[] | undefined; } /** @@ -80,7 +80,7 @@ export namespace Company { */ export interface Notes { /** The type of the object */ - type?: "note.list"; - notes?: Intercom.unstable.CompanyNote[]; + type?: "note.list" | undefined; + notes?: Intercom.unstable.CompanyNote[] | undefined; } } diff --git a/src/api/resources/unstable/resources/contacts/client/Client.ts b/src/api/resources/unstable/resources/contacts/client/Client.ts index 531e8b52..94931fea 100644 --- a/src/api/resources/unstable/resources/contacts/client/Client.ts +++ b/src/api/resources/unstable/resources/contacts/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace ContactsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +34,8 @@ export class ContactsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.listCompaniesForAContact({ @@ -63,11 +66,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}/companies`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}/companies`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -110,6 +113,8 @@ export class ContactsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.listSegmentsForAContact({ @@ -140,11 +145,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/segments`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/segments`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -195,6 +200,8 @@ export class ContactsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.listSubscriptionsForAContact({ @@ -225,11 +232,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/subscriptions`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/subscriptions`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -277,6 +284,8 @@ export class ContactsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.listTagsForAContact({ @@ -307,11 +316,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/tags`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/tags`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -350,6 +359,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.showContact({ @@ -380,11 +391,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -430,6 +441,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.updateContact({ @@ -472,14 +485,14 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -519,6 +532,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.deleteContact({ @@ -549,11 +564,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -590,6 +605,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.mergeContact({ @@ -625,9 +642,9 @@ export class ContactsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -766,6 +783,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.searchContacts({ @@ -810,9 +829,9 @@ export class ContactsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -852,6 +871,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.listContacts() @@ -881,7 +902,7 @@ export class ContactsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -914,10 +935,12 @@ export class ContactsClient { /** * You can create a new contact (ie. user or lead). * - * @param {Intercom.CreateContactRequestTwo} request + * @param {Intercom.unstable.CreateContactRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.createContact({ @@ -925,14 +948,14 @@ export class ContactsClient { * }) */ public createContact( - request?: Intercom.CreateContactRequestTwo, + request: Intercom.unstable.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__createContact(request, requestOptions)); } private async __createContact( - request?: Intercom.CreateContactRequestTwo, + request: Intercom.unstable.CreateContactRequest, requestOptions?: ContactsClient.RequestOptions, ): Promise> { const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); @@ -952,9 +975,9 @@ export class ContactsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -994,6 +1017,8 @@ export class ContactsClient { * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.contacts.showContactByExternalId({ @@ -1024,11 +1049,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/find_by_external_id/${core.url.encodePathParam(externalId)}`, + `contacts/find_by_external_id/${core.url.encodePathParam(externalId, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1072,6 +1097,9 @@ export class ContactsClient { * @param {Intercom.unstable.ArchiveContactRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.contacts.archiveContact({ * id: "63a07ddf05a32042dffac965" @@ -1101,11 +1129,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}/archive`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}/archive`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1133,6 +1161,9 @@ export class ContactsClient { * @param {Intercom.unstable.UnarchiveContactRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.contacts.unarchiveContact({ * id: "63a07ddf05a32042dffac965" @@ -1162,11 +1193,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}/unarchive`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}/unarchive`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1194,6 +1225,9 @@ export class ContactsClient { * @param {Intercom.unstable.BlockContactRequest} request * @param {ContactsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.contacts.blockContact({ * id: "63a07ddf05a32042dffac965" @@ -1223,11 +1257,11 @@ export class ContactsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}/block`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}/block`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/contacts/exports.ts b/src/api/resources/unstable/resources/contacts/exports.ts new file mode 100644 index 00000000..657fdf5e --- /dev/null +++ b/src/api/resources/unstable/resources/contacts/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ContactsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/contacts/types/Contact.ts b/src/api/resources/unstable/resources/contacts/types/Contact.ts index cb4e3927..f5f2881e 100644 --- a/src/api/resources/unstable/resources/contacts/types/Contact.ts +++ b/src/api/resources/unstable/resources/contacts/types/Contact.ts @@ -7,98 +7,98 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Contact { /** The type of object. */ - type?: string; + type?: string | undefined; /** The unique identifier for the contact which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; + external_id?: string | undefined; /** The id of the workspace which the contact belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The role of the contact. */ - role?: string; + role?: string | undefined; /** The contact's email. */ - email?: string; + email?: string | undefined; /** The contact's email domain. */ - email_domain?: string; + email_domain?: string | undefined; /** The contacts phone. */ - phone?: string; + phone?: string | undefined; /** The contacts phone number normalized to the E164 format */ - formatted_phone?: string; + formatted_phone?: string | undefined; /** The contacts name. */ - name?: string; + name?: string | undefined; /** The id of an admin that has been assigned account ownership of the contact. */ - owner_id?: number; + owner_id?: number | undefined; /** Whether the contact has had an email sent to them hard bounce. */ - has_hard_bounced?: boolean; + has_hard_bounced?: boolean | undefined; /** Whether the contact has marked an email sent to them as spam. */ - marked_email_as_spam?: boolean; + marked_email_as_spam?: boolean | undefined; /** Whether the contact is unsubscribed from emails. */ - unsubscribed_from_emails?: boolean; + unsubscribed_from_emails?: boolean | undefined; /** (UNIX timestamp) The time when the contact was created. */ - created_at?: number; + created_at?: number | undefined; /** (UNIX timestamp) The time when the contact was last updated. */ - updated_at?: number; + updated_at?: number | undefined; /** (UNIX timestamp) The time specified for when a contact signed up. */ - signed_up_at?: number; + signed_up_at?: number | undefined; /** (UNIX timestamp) The time when the contact was last seen (either where the Intercom Messenger was installed or when specified manually). */ - last_seen_at?: number; + last_seen_at?: number | undefined; /** (UNIX timestamp) The time when the contact last messaged in. */ - last_replied_at?: number; + last_replied_at?: number | undefined; /** (UNIX timestamp) The time when the contact was last messaged. */ - last_contacted_at?: number; + last_contacted_at?: number | undefined; /** (UNIX timestamp) The time when the contact last opened an email. */ - last_email_opened_at?: number; + last_email_opened_at?: number | undefined; /** (UNIX timestamp) The time when the contact last clicked a link in an email. */ - last_email_clicked_at?: number; + last_email_clicked_at?: number | undefined; /** A preferred language setting for the contact, used by Intercom as the language of Fin and the Messenger even if their browser has a different setting. Supports ISO 639-1 two-letter language codes. If an unsupported code is supplied, the field will be set to null. */ - language_override?: string; + language_override?: string | undefined; /** The name of the browser which the contact is using. */ - browser?: string; + browser?: string | undefined; /** The version of the browser which the contact is using. */ - browser_version?: string; + browser_version?: string | undefined; /** The language set by the browser which the contact is using. */ - browser_language?: string; + browser_language?: string | undefined; /** The operating system which the contact is using. */ - os?: string; + os?: string | undefined; /** The name of the Android app which the contact is using. */ - android_app_name?: string; + android_app_name?: string | undefined; /** The version of the Android app which the contact is using. */ - android_app_version?: string; + android_app_version?: string | undefined; /** The Android device which the contact is using. */ - android_device?: string; + android_device?: string | undefined; /** The version of the Android OS which the contact is using. */ - android_os_version?: string; + android_os_version?: string | undefined; /** The version of the Android SDK which the contact is using. */ - android_sdk_version?: string; + android_sdk_version?: string | undefined; /** (UNIX timestamp) The time when the contact was last seen on an Android device. */ - android_last_seen_at?: number; + android_last_seen_at?: number | undefined; /** The name of the iOS app which the contact is using. */ - ios_app_name?: string; + ios_app_name?: string | undefined; /** The version of the iOS app which the contact is using. */ - ios_app_version?: string; + ios_app_version?: string | undefined; /** The iOS device which the contact is using. */ - ios_device?: string; + ios_device?: string | undefined; /** The version of iOS which the contact is using. */ - ios_os_version?: string; + ios_os_version?: string | undefined; /** The version of the iOS SDK which the contact is using. */ - ios_sdk_version?: string; + ios_sdk_version?: string | undefined; /** (UNIX timestamp) The last time the contact used the iOS app. */ - ios_last_seen_at?: number; + ios_last_seen_at?: number | undefined; /** The custom attributes which are set for the contact. */ - custom_attributes?: Record; - avatar?: Contact.Avatar; - tags?: Intercom.unstable.ContactTags; - notes?: Intercom.unstable.ContactNotes; - companies?: Intercom.unstable.ContactCompanies; - location?: Intercom.unstable.ContactLocation; - social_profiles?: Intercom.unstable.ContactSocialProfiles; + custom_attributes?: Record | undefined; + avatar?: Contact.Avatar | undefined; + tags?: Intercom.unstable.ContactTags | undefined; + notes?: Intercom.unstable.ContactNotes | undefined; + companies?: Intercom.unstable.ContactCompanies | undefined; + location?: Intercom.unstable.ContactLocation | undefined; + social_profiles?: Intercom.unstable.ContactSocialProfiles | undefined; } export namespace Contact { export interface Avatar { /** The type of object */ - type?: string; + type?: string | undefined; /** An image URL containing the avatar of a contact. */ - image_url?: string; + image_url?: string | undefined; } } diff --git a/src/api/resources/unstable/resources/contacts/types/CreateContactResponse.ts b/src/api/resources/unstable/resources/contacts/types/CreateContactResponse.ts index e7bb8739..08c7bedc 100644 --- a/src/api/resources/unstable/resources/contacts/types/CreateContactResponse.ts +++ b/src/api/resources/unstable/resources/contacts/types/CreateContactResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../../../index.js"; export interface CreateContactResponse extends Intercom.unstable.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/unstable/resources/contacts/types/MergeContactResponse.ts b/src/api/resources/unstable/resources/contacts/types/MergeContactResponse.ts index 6a253944..1e53212b 100644 --- a/src/api/resources/unstable/resources/contacts/types/MergeContactResponse.ts +++ b/src/api/resources/unstable/resources/contacts/types/MergeContactResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../../../index.js"; export interface MergeContactResponse extends Intercom.unstable.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/unstable/resources/contacts/types/ShowContactByExternalIdResponse.ts b/src/api/resources/unstable/resources/contacts/types/ShowContactByExternalIdResponse.ts index 2e8b3f12..0eae7680 100644 --- a/src/api/resources/unstable/resources/contacts/types/ShowContactByExternalIdResponse.ts +++ b/src/api/resources/unstable/resources/contacts/types/ShowContactByExternalIdResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../../../index.js"; export interface ShowContactByExternalIdResponse extends Intercom.unstable.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/unstable/resources/contacts/types/ShowContactResponse.ts b/src/api/resources/unstable/resources/contacts/types/ShowContactResponse.ts index e8ffabcc..3383db50 100644 --- a/src/api/resources/unstable/resources/contacts/types/ShowContactResponse.ts +++ b/src/api/resources/unstable/resources/contacts/types/ShowContactResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../../../index.js"; export interface ShowContactResponse extends Intercom.unstable.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/unstable/resources/contacts/types/UpdateContactResponse.ts b/src/api/resources/unstable/resources/contacts/types/UpdateContactResponse.ts index c67687b2..f067dabd 100644 --- a/src/api/resources/unstable/resources/contacts/types/UpdateContactResponse.ts +++ b/src/api/resources/unstable/resources/contacts/types/UpdateContactResponse.ts @@ -4,5 +4,5 @@ import type * as Intercom from "../../../../../index.js"; export interface UpdateContactResponse extends Intercom.unstable.Contact { /** If the user has enabled push messaging. */ - enabled_push_messaging?: boolean; + enabled_push_messaging?: boolean | undefined; } diff --git a/src/api/resources/unstable/resources/conversations/client/Client.ts b/src/api/resources/unstable/resources/conversations/client/Client.ts index 1823bcca..95625271 100644 --- a/src/api/resources/unstable/resources/conversations/client/Client.ts +++ b/src/api/resources/unstable/resources/conversations/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace ConversationsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -39,6 +40,8 @@ export class ConversationsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.listConversations({ @@ -58,15 +61,10 @@ export class ConversationsClient { requestOptions?: ConversationsClient.RequestOptions, ): Promise> { const { per_page: perPage, starting_after: startingAfter } = request; - const _queryParams: Record = {}; - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - - if (startingAfter != null) { - _queryParams.starting_after = startingAfter; - } - + const _queryParams: Record = { + per_page: perPage, + starting_after: startingAfter, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -83,7 +81,11 @@ export class ConversationsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -136,6 +138,8 @@ export class ConversationsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.createConversation({ @@ -183,9 +187,9 @@ export class ConversationsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -240,6 +244,8 @@ export class ConversationsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.retrieveConversation({ @@ -260,15 +266,10 @@ export class ConversationsClient { requestOptions?: ConversationsClient.RequestOptions, ): Promise> { const { id, display_as: displayAs, include_translations: includeTranslations } = request; - const _queryParams: Record = {}; - if (displayAs != null) { - _queryParams.display_as = displayAs; - } - - if (includeTranslations != null) { - _queryParams.include_translations = includeTranslations.toString(); - } - + const _queryParams: Record = { + display_as: displayAs, + include_translations: includeTranslations, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -281,11 +282,15 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(id)}`, + `conversations/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -343,6 +348,8 @@ export class ConversationsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.updateConversation({ @@ -377,11 +384,9 @@ export class ConversationsClient { requestOptions?: ConversationsClient.RequestOptions, ): Promise> { const { id, display_as: displayAs, ..._body } = request; - const _queryParams: Record = {}; - if (displayAs != null) { - _queryParams.display_as = displayAs; - } - + const _queryParams: Record = { + display_as: displayAs, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -394,14 +399,18 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(id)}`, + `conversations/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -446,6 +455,8 @@ export class ConversationsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.deleteConversation({ @@ -476,11 +487,11 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(id)}`, + `conversations/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -622,6 +633,9 @@ export class ConversationsClient { * @param {Intercom.unstable.SearchRequest} request * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.conversations.searchConversations({ * query: { @@ -665,9 +679,9 @@ export class ConversationsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -692,12 +706,14 @@ export class ConversationsClient { /** * You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins. * - * @param {Intercom.unstable.ReplyConversationRequest} request + * @param {Intercom.unstable.ReplyConversationBody} request * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.replyConversation({ @@ -765,14 +781,14 @@ export class ConversationsClient { * }) */ public replyConversation( - request: Intercom.unstable.ReplyConversationRequest, + request: Intercom.unstable.ReplyConversationBody, requestOptions?: ConversationsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__replyConversation(request, requestOptions)); } private async __replyConversation( - request: Intercom.unstable.ReplyConversationRequest, + request: Intercom.unstable.ReplyConversationBody, requestOptions?: ConversationsClient.RequestOptions, ): Promise> { const { id, body: _body } = request; @@ -788,14 +804,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(id)}/reply`, + `conversations/${core.url.encodePathParam(id, errors.IntercomError)}/reply`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -845,6 +861,8 @@ export class ConversationsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.manageConversation({ @@ -910,14 +928,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(id)}/parts`, + `conversations/${core.url.encodePathParam(id, errors.IntercomError)}/parts`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -968,6 +986,8 @@ export class ConversationsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.attachContactToConversation({ @@ -1011,14 +1031,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(id)}/customers`, + `conversations/${core.url.encodePathParam(id, errors.IntercomError)}/customers`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1075,6 +1095,8 @@ export class ConversationsClient { * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} * @throws {@link Intercom.unstable.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.detachContactFromConversation({ @@ -1107,14 +1129,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/customers/${core.url.encodePathParam(contactId)}`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/customers/${core.url.encodePathParam(contactId, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1171,6 +1193,8 @@ export class ConversationsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.listHandlingEvents({ @@ -1201,11 +1225,11 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(id)}/handling_events`, + `conversations/${core.url.encodePathParam(id, errors.IntercomError)}/handling_events`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1255,6 +1279,8 @@ export class ConversationsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.redactConversation({ @@ -1298,9 +1324,9 @@ export class ConversationsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -1339,6 +1365,8 @@ export class ConversationsClient { * @param {ConversationsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.BadRequestError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.conversations.convertConversationToTicket({ @@ -1376,14 +1404,14 @@ export class ConversationsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(id)}/convert`, + `conversations/${core.url.encodePathParam(id, errors.IntercomError)}/convert`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/conversations/client/requests/DetachContactFromConversationRequest.ts b/src/api/resources/unstable/resources/conversations/client/requests/DetachContactFromConversationRequest.ts index 415bfae9..12fcfce7 100644 --- a/src/api/resources/unstable/resources/conversations/client/requests/DetachContactFromConversationRequest.ts +++ b/src/api/resources/unstable/resources/conversations/client/requests/DetachContactFromConversationRequest.ts @@ -1,27 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * conversation_id: "123", - * contact_id: "123", - * admin_id: "5017690" - * } - * - * @example - * { - * conversation_id: "123", - * contact_id: "123", - * admin_id: "5017690" - * } - * - * @example - * { - * conversation_id: "123", - * contact_id: "123", - * admin_id: "5017690" - * } - * * @example * { * conversation_id: "123", diff --git a/src/api/resources/unstable/resources/conversations/client/requests/ManageConversationRequest.ts b/src/api/resources/unstable/resources/conversations/client/requests/ManageConversationRequest.ts index 54ff3cf5..fd206188 100644 --- a/src/api/resources/unstable/resources/conversations/client/requests/ManageConversationRequest.ts +++ b/src/api/resources/unstable/resources/conversations/client/requests/ManageConversationRequest.ts @@ -42,16 +42,6 @@ import type * as Intercom from "../../../../../../index.js"; * assignee_id: "4324241" * } * } - * - * @example - * { - * id: "123", - * body: { - * message_type: "close", - * type: "admin", - * admin_id: "12345" - * } - * } */ export interface ManageConversationRequest { /** The identifier for the conversation as given by Intercom. */ diff --git a/src/api/resources/unstable/resources/conversations/client/requests/ReplyConversationRequest.ts b/src/api/resources/unstable/resources/conversations/client/requests/ReplyConversationBody.ts similarity index 98% rename from src/api/resources/unstable/resources/conversations/client/requests/ReplyConversationRequest.ts rename to src/api/resources/unstable/resources/conversations/client/requests/ReplyConversationBody.ts index 3653ec6d..b2ffddaf 100644 --- a/src/api/resources/unstable/resources/conversations/client/requests/ReplyConversationRequest.ts +++ b/src/api/resources/unstable/resources/conversations/client/requests/ReplyConversationBody.ts @@ -68,7 +68,7 @@ import type * as Intercom from "../../../../../../index.js"; * } * } */ -export interface ReplyConversationRequest { +export interface ReplyConversationBody { /** The Intercom provisioned identifier for the conversation or the string "last" to reply to the last part of the conversation */ id: string; body: Intercom.unstable.ReplyConversationRequestBody; diff --git a/src/api/resources/unstable/resources/conversations/client/requests/UpdateConversationRequest.ts b/src/api/resources/unstable/resources/conversations/client/requests/UpdateConversationRequest.ts index 9e2a3dea..5ea8cabf 100644 --- a/src/api/resources/unstable/resources/conversations/client/requests/UpdateConversationRequest.ts +++ b/src/api/resources/unstable/resources/conversations/client/requests/UpdateConversationRequest.ts @@ -23,18 +23,6 @@ import type * as Intercom from "../../../../../../index.js"; * "order": {} * } * } - * - * @example - * { - * id: 1, - * display_as: "plaintext", - * read: true, - * title: "new conversation title", - * custom_attributes: { - * "issue_type": "Billing", - * "priority": "High" - * } - * } */ export interface UpdateConversationRequest { /** The id of the conversation to target */ diff --git a/src/api/resources/unstable/resources/conversations/client/requests/index.ts b/src/api/resources/unstable/resources/conversations/client/requests/index.ts index 3733a95d..a74ac4a2 100644 --- a/src/api/resources/unstable/resources/conversations/client/requests/index.ts +++ b/src/api/resources/unstable/resources/conversations/client/requests/index.ts @@ -1,11 +1,11 @@ export type { AttachContactToConversationRequest } from "./AttachContactToConversationRequest.js"; export type { ConvertConversationToTicketRequest } from "./ConvertConversationToTicketRequest.js"; -export type { CreateConversationRequest } from "./CreateConversationRequest.js"; +export { CreateConversationRequest } from "./CreateConversationRequest.js"; export type { DeleteConversationRequest } from "./DeleteConversationRequest.js"; export type { DetachContactFromConversationRequest } from "./DetachContactFromConversationRequest.js"; export type { ListConversationsRequest } from "./ListConversationsRequest.js"; export type { ListHandlingEventsRequest } from "./ListHandlingEventsRequest.js"; export type { ManageConversationRequest } from "./ManageConversationRequest.js"; -export type { ReplyConversationRequest } from "./ReplyConversationRequest.js"; +export type { ReplyConversationBody } from "./ReplyConversationBody.js"; export type { RetrieveConversationRequest } from "./RetrieveConversationRequest.js"; export type { UpdateConversationRequest } from "./UpdateConversationRequest.js"; diff --git a/src/api/resources/unstable/resources/conversations/exports.ts b/src/api/resources/unstable/resources/conversations/exports.ts new file mode 100644 index 00000000..82be4a7f --- /dev/null +++ b/src/api/resources/unstable/resources/conversations/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ConversationsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/conversations/types/Conversation.ts b/src/api/resources/unstable/resources/conversations/types/Conversation.ts index d53ea2a2..40da2534 100644 --- a/src/api/resources/unstable/resources/conversations/types/Conversation.ts +++ b/src/api/resources/unstable/resources/conversations/types/Conversation.ts @@ -7,49 +7,49 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Conversation { /** Always conversation. */ - type?: string; + type?: string | undefined; /** The id representing the conversation. */ - id?: string; + id?: string | undefined; /** The title given to the conversation. */ - title?: string; + title?: string | undefined; /** The time the conversation was created. */ - created_at?: number; + created_at?: number | undefined; /** The last time the conversation was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The last time a Contact responded to an Admin. In other words, the time a customer started waiting for a response. Set to null if last reply is from an Admin. */ - waiting_since?: number; + waiting_since?: number | undefined; /** If set this is the time in the future when this conversation will be marked as open. i.e. it will be in a snoozed state until this time. i.e. it will be in a snoozed state until this time. */ - snoozed_until?: number; + snoozed_until?: number | undefined; /** Indicates whether a conversation is open (true) or closed (false). */ - open?: boolean; + open?: boolean | undefined; /** Can be set to "open", "closed" or "snoozed". */ - state?: Conversation.State; + state?: Conversation.State | undefined; /** Indicates whether a conversation has been read. */ - read?: boolean; + read?: boolean | undefined; /** If marked as priority, it will return priority or else not_priority. */ - priority?: Conversation.Priority; + priority?: Conversation.Priority | undefined; /** The id of the admin assigned to the conversation. If it's not assigned to an admin it will return null. */ - admin_assignee_id?: number; + admin_assignee_id?: number | undefined; /** The id of the team assigned to the conversation. If it's not assigned to a team it will return null. */ - team_assignee_id?: string; + team_assignee_id?: string | undefined; /** The ID of the company that the conversation is associated with. The unique identifier for the company which is given by Intercom. */ - company_id?: string; + company_id?: string | undefined; /** The company associated with the conversation. */ - company?: Intercom.unstable.Company; - tags?: Intercom.unstable.Tags; - conversation_rating?: Intercom.unstable.ConversationRating; - source?: Intercom.unstable.ConversationSource; - contacts?: Intercom.unstable.ConversationContacts; - teammates?: Intercom.unstable.ConversationTeammates; - custom_attributes?: Intercom.unstable.CustomAttributes; - first_contact_reply?: Intercom.unstable.ConversationFirstContactReply; - sla_applied?: Intercom.unstable.SlaApplied; - statistics?: Intercom.unstable.ConversationStatistics; - conversation_parts?: Intercom.unstable.ConversationParts; - linked_objects?: Intercom.unstable.LinkedObjectList; + company?: Intercom.unstable.Company | undefined; + tags?: Intercom.unstable.Tags | undefined; + conversation_rating?: Intercom.unstable.ConversationRating | undefined; + source?: Intercom.unstable.ConversationSource | undefined; + contacts?: Intercom.unstable.ConversationContacts | undefined; + teammates?: Intercom.unstable.ConversationTeammates | undefined; + custom_attributes?: Intercom.unstable.CustomAttributes | undefined; + first_contact_reply?: Intercom.unstable.ConversationFirstContactReply | undefined; + sla_applied?: Intercom.unstable.SlaApplied | undefined; + statistics?: Intercom.unstable.ConversationStatistics | undefined; + conversation_parts?: Intercom.unstable.ConversationParts | undefined; + linked_objects?: Intercom.unstable.LinkedObjectList | undefined; /** Indicates whether the AI Agent participated in the conversation. */ - ai_agent_participated?: boolean; - ai_agent?: Intercom.unstable.AiAgent; + ai_agent_participated?: boolean | undefined; + ai_agent?: Intercom.unstable.AiAgent | undefined; } export namespace Conversation { diff --git a/src/api/resources/unstable/resources/customChannelEvents/client/Client.ts b/src/api/resources/unstable/resources/customChannelEvents/client/Client.ts index fdb99c2e..ef76db82 100644 --- a/src/api/resources/unstable/resources/customChannelEvents/client/Client.ts +++ b/src/api/resources/unstable/resources/customChannelEvents/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace CustomChannelEventsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +34,8 @@ export class CustomChannelEventsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} * @throws {@link Intercom.unstable.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customChannelEvents.notifyNewConversation({ @@ -74,9 +77,9 @@ export class CustomChannelEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -134,6 +137,8 @@ export class CustomChannelEventsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} * @throws {@link Intercom.unstable.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customChannelEvents.notifyNewMessage({ @@ -176,9 +181,9 @@ export class CustomChannelEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -236,6 +241,8 @@ export class CustomChannelEventsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} * @throws {@link Intercom.unstable.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customChannelEvents.notifyQuickReplySelected({ @@ -278,9 +285,9 @@ export class CustomChannelEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -338,6 +345,8 @@ export class CustomChannelEventsClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} * @throws {@link Intercom.unstable.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customChannelEvents.notifyAttributeCollected({ @@ -383,9 +392,9 @@ export class CustomChannelEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/customChannelEvents/exports.ts b/src/api/resources/unstable/resources/customChannelEvents/exports.ts new file mode 100644 index 00000000..39f83221 --- /dev/null +++ b/src/api/resources/unstable/resources/customChannelEvents/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CustomChannelEventsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/customObjectInstances/client/Client.ts b/src/api/resources/unstable/resources/customObjectInstances/client/Client.ts index a8ff8f05..cbe10789 100644 --- a/src/api/resources/unstable/resources/customObjectInstances/client/Client.ts +++ b/src/api/resources/unstable/resources/customObjectInstances/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace CustomObjectInstancesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -36,6 +37,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customObjectInstances.getCustomObjectInstancesByExternalId({ @@ -57,8 +60,9 @@ export class CustomObjectInstancesClient { requestOptions?: CustomObjectInstancesClient.RequestOptions, ): Promise> { const { custom_object_type_identifier: customObjectTypeIdentifier, external_id: externalId } = request; - const _queryParams: Record = {}; - _queryParams.external_id = externalId; + const _queryParams: Record = { + external_id: externalId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -71,11 +75,15 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -123,6 +131,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customObjectInstances.createCustomObjectInstances({ @@ -160,14 +170,14 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -215,6 +225,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customObjectInstances.deleteCustomObjectInstancesById({ @@ -234,8 +246,9 @@ export class CustomObjectInstancesClient { requestOptions?: CustomObjectInstancesClient.RequestOptions, ): Promise> { const { custom_object_type_identifier: customObjectTypeIdentifier, external_id: externalId } = request; - const _queryParams: Record = {}; - _queryParams.external_id = externalId; + const _queryParams: Record = { + external_id: externalId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -248,11 +261,15 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -300,6 +317,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customObjectInstances.getCustomObjectInstancesById({ @@ -331,11 +350,11 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}/${core.url.encodePathParam(id)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -383,6 +402,8 @@ export class CustomObjectInstancesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.customObjectInstances.deleteCustomObjectInstancesByExternalId({ @@ -416,11 +437,11 @@ export class CustomObjectInstancesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier)}/${core.url.encodePathParam(id)}`, + `custom_object_instances/${core.url.encodePathParam(customObjectTypeIdentifier, errors.IntercomError)}/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/customObjectInstances/exports.ts b/src/api/resources/unstable/resources/customObjectInstances/exports.ts new file mode 100644 index 00000000..2d0a967b --- /dev/null +++ b/src/api/resources/unstable/resources/customObjectInstances/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { CustomObjectInstancesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/customObjectInstances/types/CustomObjectInstance.ts b/src/api/resources/unstable/resources/customObjectInstances/types/CustomObjectInstance.ts index a4363acf..74c0157a 100644 --- a/src/api/resources/unstable/resources/customObjectInstances/types/CustomObjectInstance.ts +++ b/src/api/resources/unstable/resources/customObjectInstances/types/CustomObjectInstance.ts @@ -5,19 +5,19 @@ */ export interface CustomObjectInstance { /** The Intercom defined id representing the custom object instance. */ - id?: string; + id?: string | undefined; /** The id you have defined for the custom object instance. */ - external_id?: string; + external_id?: string | undefined; /** The time when the Custom Object instance was created in the external system it originated from. */ - external_created_at?: number; + external_created_at?: number | undefined; /** The time when the Custom Object instance was last updated in the external system it originated from. */ - external_updated_at?: number; + external_updated_at?: number | undefined; /** The time the attribute was created as a UTC Unix timestamp */ - created_at?: number; + created_at?: number | undefined; /** The time the attribute was last updated as a UTC Unix timestamp */ - updated_at?: number; + updated_at?: number | undefined; /** The identifier of the custom object type that defines the structure of the custom object instance. */ - type?: string; + type?: string | undefined; /** The custom attributes you have set on the custom object instance. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; } diff --git a/src/api/resources/unstable/resources/dataAttributes/client/Client.ts b/src/api/resources/unstable/resources/dataAttributes/client/Client.ts index 1778c2d1..32badac5 100644 --- a/src/api/resources/unstable/resources/dataAttributes/client/Client.ts +++ b/src/api/resources/unstable/resources/dataAttributes/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace DataAttributesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +33,8 @@ export class DataAttributesClient { * @param {DataAttributesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.dataAttributes.lisDataAttributes({ @@ -51,15 +54,10 @@ export class DataAttributesClient { requestOptions?: DataAttributesClient.RequestOptions, ): Promise> { const { model, include_archived: includeArchived } = request; - const _queryParams: Record = {}; - if (model != null) { - _queryParams.model = model; - } - - if (includeArchived != null) { - _queryParams.include_archived = includeArchived.toString(); - } - + const _queryParams: Record = { + model: model != null ? model : undefined, + include_archived: includeArchived, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -76,7 +74,11 @@ export class DataAttributesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -114,6 +116,8 @@ export class DataAttributesClient { * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.dataAttributes.createDataAttribute({ @@ -148,9 +152,9 @@ export class DataAttributesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -190,13 +194,15 @@ export class DataAttributesClient { * > * > It is currently a dangerous action to execute changing a data attribute's type via the API. You will need to update the type via the UI instead. * - * @param {Intercom.unstable.UpdateDataAttributeRequest} request + * @param {Intercom.unstable.UpdateDataAttributeBody} request * @param {DataAttributesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} * @throws {@link Intercom.unstable.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.dataAttributes.updateDataAttribute({ @@ -207,14 +213,14 @@ export class DataAttributesClient { * }) */ public updateDataAttribute( - request: Intercom.unstable.UpdateDataAttributeRequest, + request: Intercom.unstable.UpdateDataAttributeBody, requestOptions?: DataAttributesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updateDataAttribute(request, requestOptions)); } private async __updateDataAttribute( - request: Intercom.unstable.UpdateDataAttributeRequest, + request: Intercom.unstable.UpdateDataAttributeBody, requestOptions?: DataAttributesClient.RequestOptions, ): Promise> { const { id, body: _body } = request; @@ -230,14 +236,14 @@ export class DataAttributesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `data_attributes/${core.url.encodePathParam(id)}`, + `data_attributes/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts b/src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeBody.ts similarity index 84% rename from src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts rename to src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeBody.ts index a2d7f595..40940d51 100644 --- a/src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeRequest.ts +++ b/src/api/resources/unstable/resources/dataAttributes/client/requests/UpdateDataAttributeBody.ts @@ -9,7 +9,7 @@ * } * } */ -export interface UpdateDataAttributeRequest { +export interface UpdateDataAttributeBody { /** The data attribute id */ id: number; body?: unknown; diff --git a/src/api/resources/unstable/resources/dataAttributes/client/requests/index.ts b/src/api/resources/unstable/resources/dataAttributes/client/requests/index.ts index 7776c48b..1b592713 100644 --- a/src/api/resources/unstable/resources/dataAttributes/client/requests/index.ts +++ b/src/api/resources/unstable/resources/dataAttributes/client/requests/index.ts @@ -1,2 +1,2 @@ export type { LisDataAttributesRequest } from "./LisDataAttributesRequest.js"; -export type { UpdateDataAttributeRequest } from "./UpdateDataAttributeRequest.js"; +export type { UpdateDataAttributeBody } from "./UpdateDataAttributeBody.js"; diff --git a/src/api/resources/unstable/resources/dataAttributes/exports.ts b/src/api/resources/unstable/resources/dataAttributes/exports.ts new file mode 100644 index 00000000..80f9fc3a --- /dev/null +++ b/src/api/resources/unstable/resources/dataAttributes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { DataAttributesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/dataAttributes/types/DataAttribute.ts b/src/api/resources/unstable/resources/dataAttributes/types/DataAttribute.ts index 090b36d1..8717e576 100644 --- a/src/api/resources/unstable/resources/dataAttributes/types/DataAttribute.ts +++ b/src/api/resources/unstable/resources/dataAttributes/types/DataAttribute.ts @@ -5,39 +5,39 @@ */ export interface DataAttribute { /** Value is `data_attribute`. */ - type?: "data_attribute"; + type?: "data_attribute" | undefined; /** The unique identifier for the data attribute which is given by Intercom. Only available for custom attributes. */ - id?: number; + id?: number | undefined; /** Value is `contact` for user/lead attributes and `company` for company attributes. */ - model?: DataAttribute.Model; + model?: DataAttribute.Model | undefined; /** Name of the attribute. */ - name?: string; + name?: string | undefined; /** Full name of the attribute. Should match the name unless it's a nested attribute. We can split full_name on `.` to access nested user object values. */ - full_name?: string; + full_name?: string | undefined; /** Readable name of the attribute (i.e. name you see in the UI) */ - label?: string; + label?: string | undefined; /** Readable description of the attribute. */ - description?: string; + description?: string | undefined; /** The data type of the attribute. */ - data_type?: DataAttribute.DataType; + data_type?: DataAttribute.DataType | undefined; /** List of predefined options for attribute value. */ - options?: string[]; + options?: string[] | undefined; /** Can this attribute be updated through API */ - api_writable?: boolean; + api_writable?: boolean | undefined; /** Can this attribute be updated by the Messenger */ - messenger_writable?: boolean; + messenger_writable?: boolean | undefined; /** Can this attribute be updated in the UI */ - ui_writable?: boolean; + ui_writable?: boolean | undefined; /** Set to true if this is a CDA */ - custom?: boolean; + custom?: boolean | undefined; /** Is this attribute archived. (Only applicable to CDAs) */ - archived?: boolean; + archived?: boolean | undefined; /** The time the attribute was created as a UTC Unix timestamp */ - created_at?: number; + created_at?: number | undefined; /** The time the attribute was last updated as a UTC Unix timestamp */ - updated_at?: number; + updated_at?: number | undefined; /** Teammate who created the attribute. Only applicable to CDAs */ - admin_id?: string; + admin_id?: string | undefined; } export namespace DataAttribute { diff --git a/src/api/resources/unstable/resources/dataEvents/client/Client.ts b/src/api/resources/unstable/resources/dataEvents/client/Client.ts index ad66e987..41ba3868 100644 --- a/src/api/resources/unstable/resources/dataEvents/client/Client.ts +++ b/src/api/resources/unstable/resources/dataEvents/client/Client.ts @@ -5,13 +5,14 @@ import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; import { toJson } from "../../../../../../core/json.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace DataEventsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -46,6 +47,8 @@ export class DataEventsClient { * @param {DataEventsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.dataEvents.lisDataEvents({ @@ -67,13 +70,15 @@ export class DataEventsClient { requestOptions?: DataEventsClient.RequestOptions, ): Promise> { const { filter, type: type_, summary } = request; - const _queryParams: Record = {}; - _queryParams.filter = typeof filter === "string" ? filter : toJson(filter); - _queryParams.type = type_; - if (summary != null) { - _queryParams.summary = summary.toString(); - } - + const _queryParams: Record = { + filter: Array.isArray(filter) + ? filter.map((item) => (typeof item === "string" ? item : toJson(item))) + : typeof filter === "string" + ? filter + : toJson(filter), + type: type_, + summary, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -90,7 +95,11 @@ export class DataEventsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -164,10 +173,12 @@ export class DataEventsClient { * - Server errors will return a `500` response code and may contain an error message in the body. * * - * @param {Intercom.CreateDataEventRequestTwo} request + * @param {Intercom.unstable.CreateDataEventRequest} request * @param {DataEventsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.dataEvents.createDataEvent({ @@ -175,14 +186,14 @@ export class DataEventsClient { * }) */ public createDataEvent( - request?: Intercom.CreateDataEventRequestTwo, + request: Intercom.unstable.CreateDataEventRequest, requestOptions?: DataEventsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__createDataEvent(request, requestOptions)); } private async __createDataEvent( - request?: Intercom.CreateDataEventRequestTwo, + request: Intercom.unstable.CreateDataEventRequest, requestOptions?: DataEventsClient.RequestOptions, ): Promise> { const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); @@ -202,9 +213,9 @@ export class DataEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -242,6 +253,8 @@ export class DataEventsClient { * @param {DataEventsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.dataEvents.dataEventSummaries() @@ -274,9 +287,9 @@ export class DataEventsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/dataEvents/client/requests/CreateDataEventSummariesRequest.ts b/src/api/resources/unstable/resources/dataEvents/client/requests/CreateDataEventSummariesRequest.ts index ca40dbe7..c309d7fe 100644 --- a/src/api/resources/unstable/resources/dataEvents/client/requests/CreateDataEventSummariesRequest.ts +++ b/src/api/resources/unstable/resources/dataEvents/client/requests/CreateDataEventSummariesRequest.ts @@ -17,12 +17,12 @@ export namespace CreateDataEventSummariesRequest { */ export interface EventSummaries { /** The name of the event that occurred. A good event name is typically a past tense 'verb-noun' combination, to improve readability, for example `updated-plan`. */ - event_name?: string; + event_name?: string | undefined; /** The number of times the event occurred. */ - count?: number; + count?: number | undefined; /** The first time the event was sent */ - first?: number; + first?: number | undefined; /** The last time the event was sent */ - last?: number; + last?: number | undefined; } } diff --git a/src/api/resources/unstable/resources/dataEvents/exports.ts b/src/api/resources/unstable/resources/dataEvents/exports.ts new file mode 100644 index 00000000..07e0ab32 --- /dev/null +++ b/src/api/resources/unstable/resources/dataEvents/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { DataEventsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/dataEvents/types/DataEvent.ts b/src/api/resources/unstable/resources/dataEvents/types/DataEvent.ts index a88a24e6..7cadb239 100644 --- a/src/api/resources/unstable/resources/dataEvents/types/DataEvent.ts +++ b/src/api/resources/unstable/resources/dataEvents/types/DataEvent.ts @@ -5,19 +5,19 @@ */ export interface DataEvent { /** The type of the object */ - type?: "event"; + type?: "event" | undefined; /** The name of the event that occurred. This is presented to your App's admins when filtering and creating segments - a good event name is typically a past tense 'verb-noun' combination, to improve readability, for example `updated-plan`. */ event_name: string; /** The time the event occurred as a UTC Unix timestamp */ created_at: number; /** Your identifier for the user. */ - user_id?: string; + user_id?: string | undefined; /** Your identifier for a lead or a user. */ - id?: string; + id?: string | undefined; /** The Intercom identifier for the user. */ - intercom_user_id?: string; + intercom_user_id?: string | undefined; /** An email address for your user. An email should only be used where your application uses email to uniquely identify users. */ - email?: string; + email?: string | undefined; /** Optional metadata about the event. */ - metadata?: Record; + metadata?: Record | undefined; } diff --git a/src/api/resources/unstable/resources/dataExport/client/Client.ts b/src/api/resources/unstable/resources/dataExport/client/Client.ts index 9381c9f5..207f9cf5 100644 --- a/src/api/resources/unstable/resources/dataExport/client/Client.ts +++ b/src/api/resources/unstable/resources/dataExport/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import type * as Intercom from "../../../../../index.js"; export declare namespace DataExportClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -45,6 +46,9 @@ export class DataExportClient { * @param {Intercom.unstable.CreateDataExportsRequest} request * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.dataExport.createDataExport({ * created_at_after: 1734519776, @@ -79,9 +83,9 @@ export class DataExportClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -113,6 +117,9 @@ export class DataExportClient { * @param {Intercom.unstable.GetDataExportRequest} request * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.dataExport.getDataExport({ * job_identifier: "job_identifier" @@ -142,11 +149,11 @@ export class DataExportClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `export/content/data/${core.url.encodePathParam(jobIdentifier)}`, + `export/content/data/${core.url.encodePathParam(jobIdentifier, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -179,6 +186,9 @@ export class DataExportClient { * @param {Intercom.unstable.CancelDataExportRequest} request * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.dataExport.cancelDataExport({ * job_identifier: "job_identifier" @@ -208,11 +218,11 @@ export class DataExportClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `export/cancel/${core.url.encodePathParam(jobIdentifier)}`, + `export/cancel/${core.url.encodePathParam(jobIdentifier, errors.IntercomError)}`, ), method: "POST", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -251,6 +261,9 @@ export class DataExportClient { * @param {Intercom.unstable.DownloadDataExportRequest} request * @param {DataExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.dataExport.downloadDataExport({ * job_identifier: "job_identifier" @@ -280,11 +293,11 @@ export class DataExportClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `download/content/data/${core.url.encodePathParam(jobIdentifier)}`, + `download/content/data/${core.url.encodePathParam(jobIdentifier, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/dataExport/exports.ts b/src/api/resources/unstable/resources/dataExport/exports.ts new file mode 100644 index 00000000..5d6f94df --- /dev/null +++ b/src/api/resources/unstable/resources/dataExport/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { DataExportClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/dataExport/types/DataExport.ts b/src/api/resources/unstable/resources/dataExport/types/DataExport.ts index c846e2bb..82abbcee 100644 --- a/src/api/resources/unstable/resources/dataExport/types/DataExport.ts +++ b/src/api/resources/unstable/resources/dataExport/types/DataExport.ts @@ -5,13 +5,13 @@ */ export interface DataExport { /** The identifier for your job. */ - job_identfier?: string; + job_identfier?: string | undefined; /** The current state of your job. */ - status?: DataExport.Status; + status?: DataExport.Status | undefined; /** The time after which you will not be able to access the data. */ - download_expires_at?: string; + download_expires_at?: string | undefined; /** The location where you can download your data. */ - download_url?: string; + download_url?: string | undefined; } export namespace DataExport { diff --git a/src/api/resources/unstable/resources/emails/client/Client.ts b/src/api/resources/unstable/resources/emails/client/Client.ts index 80dc6bdf..17e7761e 100644 --- a/src/api/resources/unstable/resources/emails/client/Client.ts +++ b/src/api/resources/unstable/resources/emails/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace EmailsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +31,8 @@ export class EmailsClient { * @param {EmailsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.emails.listEmails() @@ -60,7 +62,7 @@ export class EmailsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -98,6 +100,8 @@ export class EmailsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.emails.retrieveEmail({ @@ -128,11 +132,11 @@ export class EmailsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `emails/${core.url.encodePathParam(id)}`, + `emails/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/emails/exports.ts b/src/api/resources/unstable/resources/emails/exports.ts new file mode 100644 index 00000000..3e3742bf --- /dev/null +++ b/src/api/resources/unstable/resources/emails/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { EmailsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/emails/types/EmailList.ts b/src/api/resources/unstable/resources/emails/types/EmailList.ts index 41aa6d09..9a6c7705 100644 --- a/src/api/resources/unstable/resources/emails/types/EmailList.ts +++ b/src/api/resources/unstable/resources/emails/types/EmailList.ts @@ -7,6 +7,6 @@ import type * as Intercom from "../../../../../index.js"; */ export interface EmailList { /** The type of object */ - type?: string; - data?: Intercom.unstable.EmailSetting[]; + type?: string | undefined; + data?: Intercom.unstable.EmailSetting[] | undefined; } diff --git a/src/api/resources/unstable/resources/emails/types/EmailSetting.ts b/src/api/resources/unstable/resources/emails/types/EmailSetting.ts index bd584aec..3970de9a 100644 --- a/src/api/resources/unstable/resources/emails/types/EmailSetting.ts +++ b/src/api/resources/unstable/resources/emails/types/EmailSetting.ts @@ -5,23 +5,23 @@ */ export interface EmailSetting { /** The type of object */ - type?: string; + type?: string | undefined; /** Unique email setting identifier */ - id?: string; + id?: string | undefined; /** Full sender email address */ - email?: string; + email?: string | undefined; /** Whether the email address has been verified */ - verified?: boolean; + verified?: boolean | undefined; /** Domain portion of the email address */ - domain?: string; + domain?: string | undefined; /** Associated brand identifier */ - brand_id?: string; + brand_id?: string | undefined; /** Whether email forwarding is active */ - forwarding_enabled?: boolean; + forwarding_enabled?: boolean | undefined; /** Unix timestamp of last forwarded email received (null if never) */ - forwarded_email_last_received_at?: number; + forwarded_email_last_received_at?: number | undefined; /** Unix timestamp of creation */ - created_at?: number; + created_at?: number | undefined; /** Unix timestamp of last modification */ - updated_at?: number; + updated_at?: number | undefined; } diff --git a/src/api/resources/unstable/resources/export/client/Client.ts b/src/api/resources/unstable/resources/export/client/Client.ts index af0ecc87..259c7fbc 100644 --- a/src/api/resources/unstable/resources/export/client/Client.ts +++ b/src/api/resources/unstable/resources/export/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace ExportClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -29,6 +30,8 @@ export class ExportClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.TooManyRequestsError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.export.enqueueANewReportingDataExportJob({ @@ -66,9 +69,9 @@ export class ExportClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -116,6 +119,9 @@ export class ExportClient { /** * @param {ExportClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.export.listAvailableDatasetsAndAttributes() */ @@ -144,7 +150,7 @@ export class ExportClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/export/exports.ts b/src/api/resources/unstable/resources/export/exports.ts new file mode 100644 index 00000000..687fe9f8 --- /dev/null +++ b/src/api/resources/unstable/resources/export/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { ExportClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts b/src/api/resources/unstable/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts index 725ac29a..68f80121 100644 --- a/src/api/resources/unstable/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts +++ b/src/api/resources/unstable/resources/export/types/GetExportReportingDataGetDatasetsResponse.ts @@ -1,8 +1,8 @@ // This file was auto-generated by Fern from our API Definition. export interface GetExportReportingDataGetDatasetsResponse { - type?: string; - data?: GetExportReportingDataGetDatasetsResponse.Data.Item[]; + type?: string | undefined; + data?: GetExportReportingDataGetDatasetsResponse.Data.Item[] | undefined; } export namespace GetExportReportingDataGetDatasetsResponse { @@ -10,11 +10,11 @@ export namespace GetExportReportingDataGetDatasetsResponse { export namespace Data { export interface Item { - id?: string; - name?: string; - description?: string; - default_time_attribute_id?: string; - attributes?: Item.Attributes.Item[]; + id?: string | undefined; + name?: string | undefined; + description?: string | undefined; + default_time_attribute_id?: string | undefined; + attributes?: Item.Attributes.Item[] | undefined; } export namespace Item { @@ -22,8 +22,8 @@ export namespace GetExportReportingDataGetDatasetsResponse { export namespace Attributes { export interface Item { - id?: string; - name?: string; + id?: string | undefined; + name?: string | undefined; } } } diff --git a/src/api/resources/unstable/resources/export/types/PostExportReportingDataEnqueueResponse.ts b/src/api/resources/unstable/resources/export/types/PostExportReportingDataEnqueueResponse.ts index c15d988e..9e9681d0 100644 --- a/src/api/resources/unstable/resources/export/types/PostExportReportingDataEnqueueResponse.ts +++ b/src/api/resources/unstable/resources/export/types/PostExportReportingDataEnqueueResponse.ts @@ -1,8 +1,8 @@ // This file was auto-generated by Fern from our API Definition. export interface PostExportReportingDataEnqueueResponse { - job_identifier?: string; - status?: string; - download_url?: string; - download_expires_at?: string; + job_identifier?: string | undefined; + status?: string | undefined; + download_url?: string | undefined; + download_expires_at?: string | undefined; } diff --git a/src/api/resources/unstable/resources/helpCenter/client/Client.ts b/src/api/resources/unstable/resources/helpCenter/client/Client.ts index 73d06f5d..a0db6694 100644 --- a/src/api/resources/unstable/resources/helpCenter/client/Client.ts +++ b/src/api/resources/unstable/resources/helpCenter/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace HelpCenterClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +34,8 @@ export class HelpCenterClient { * @param {HelpCenterClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.helpCenter.listAllCollections() @@ -62,7 +65,7 @@ export class HelpCenterClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -100,6 +103,8 @@ export class HelpCenterClient { * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.helpCenter.createCollection({ @@ -140,9 +145,9 @@ export class HelpCenterClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -182,6 +187,8 @@ export class HelpCenterClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.helpCenter.retrieveCollection({ @@ -212,11 +219,11 @@ export class HelpCenterClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${core.url.encodePathParam(id)}`, + `help_center/collections/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -256,6 +263,8 @@ export class HelpCenterClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.helpCenter.updateCollection({ @@ -287,14 +296,14 @@ export class HelpCenterClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${core.url.encodePathParam(id)}`, + `help_center/collections/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -334,6 +343,8 @@ export class HelpCenterClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.helpCenter.deleteCollection({ @@ -364,11 +375,11 @@ export class HelpCenterClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/collections/${core.url.encodePathParam(id)}`, + `help_center/collections/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -416,6 +427,8 @@ export class HelpCenterClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.helpCenter.retrieveHelpCenter({ @@ -446,11 +459,11 @@ export class HelpCenterClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `help_center/help_centers/${core.url.encodePathParam(id)}`, + `help_center/help_centers/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -493,6 +506,8 @@ export class HelpCenterClient { * @param {HelpCenterClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.helpCenter.listHelpCenters() @@ -522,7 +537,7 @@ export class HelpCenterClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/helpCenter/client/requests/UpdateCollectionRequest.ts b/src/api/resources/unstable/resources/helpCenter/client/requests/UpdateCollectionRequest.ts index 9caeacc0..0f07ff2c 100644 --- a/src/api/resources/unstable/resources/helpCenter/client/requests/UpdateCollectionRequest.ts +++ b/src/api/resources/unstable/resources/helpCenter/client/requests/UpdateCollectionRequest.ts @@ -3,12 +3,6 @@ import type * as Intercom from "../../../../../../index.js"; /** - * @example - * { - * id: 1, - * name: "Update collection name" - * } - * * @example * { * id: 1, diff --git a/src/api/resources/unstable/resources/helpCenter/exports.ts b/src/api/resources/unstable/resources/helpCenter/exports.ts new file mode 100644 index 00000000..534da6eb --- /dev/null +++ b/src/api/resources/unstable/resources/helpCenter/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { HelpCenterClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/helpCenter/types/Collection.ts b/src/api/resources/unstable/resources/helpCenter/types/Collection.ts index 475021d4..25d15eda 100644 --- a/src/api/resources/unstable/resources/helpCenter/types/Collection.ts +++ b/src/api/resources/unstable/resources/helpCenter/types/Collection.ts @@ -7,28 +7,28 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Collection { /** The unique identifier for the collection which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The id of the workspace which the collection belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The name of the collection. For multilingual collections, this will be the name of the default language's content. */ - name?: string; + name?: string | undefined; /** The description of the collection. For multilingual help centers, this will be the description of the collection for the default language. */ - description?: string; + description?: string | undefined; /** The time when the article was created (seconds). For multilingual articles, this will be the timestamp of creation of the default language's content. */ - created_at?: number; + created_at?: number | undefined; /** The time when the article was last updated (seconds). For multilingual articles, this will be the timestamp of last update of the default language's content. */ - updated_at?: number; + updated_at?: number | undefined; /** The URL of the collection. For multilingual help centers, this will be the URL of the collection for the default language. */ - url?: string; + url?: string | undefined; /** The icon of the collection. */ - icon?: string; + icon?: string | undefined; /** The order of the section in relation to others sections within a collection. Values go from `0` upwards. `0` is the default if there's no order. */ - order?: number; + order?: number | undefined; /** The default locale of the help center. This field is only returned for multilingual help centers. */ - default_locale?: string; - translated_content?: Intercom.unstable.GroupTranslatedContent; + default_locale?: string | undefined; + translated_content?: Intercom.unstable.GroupTranslatedContent | undefined; /** The id of the parent collection. If `null` then it is the first level collection. */ - parent_id?: string; + parent_id?: string | undefined; /** The id of the help center the collection is in. */ - help_center_id?: number; + help_center_id?: number | undefined; } diff --git a/src/api/resources/unstable/resources/helpCenter/types/HelpCenter.ts b/src/api/resources/unstable/resources/helpCenter/types/HelpCenter.ts index 3715e87f..9bb8e888 100644 --- a/src/api/resources/unstable/resources/helpCenter/types/HelpCenter.ts +++ b/src/api/resources/unstable/resources/helpCenter/types/HelpCenter.ts @@ -5,21 +5,21 @@ */ export interface HelpCenter { /** The unique identifier for the Help Center which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The id of the workspace which the Help Center belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The time when the Help Center was created. */ - created_at?: number; + created_at?: number | undefined; /** The time when the Help Center was last updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The identifier of the Help Center. This is used in the URL of the Help Center. */ - identifier?: string; + identifier?: string | undefined; /** Whether the Help Center is turned on or not. This is controlled in your Help Center settings. */ - website_turned_on?: boolean; + website_turned_on?: boolean | undefined; /** The display name of the Help Center only seen by teammates. */ - display_name?: string; + display_name?: string | undefined; /** The URL for the help center, if you have a custom domain then this will show the URL using the custom domain. */ - url?: string; + url?: string | undefined; /** Custom domain configured for the help center */ - custom_domain?: string; + custom_domain?: string | undefined; } diff --git a/src/api/resources/unstable/resources/helpCenter/types/HelpCenterList.ts b/src/api/resources/unstable/resources/helpCenter/types/HelpCenterList.ts index 75bc4786..8a47a2c7 100644 --- a/src/api/resources/unstable/resources/helpCenter/types/HelpCenterList.ts +++ b/src/api/resources/unstable/resources/helpCenter/types/HelpCenterList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../../../index.js"; */ export interface HelpCenterList { /** The type of the object - `list`. */ - type?: "list"; + type?: "list" | undefined; /** An array of Help Center objects */ - data?: Intercom.unstable.HelpCenter[]; + data?: Intercom.unstable.HelpCenter[] | undefined; } diff --git a/src/api/resources/unstable/resources/internalArticles/client/Client.ts b/src/api/resources/unstable/resources/internalArticles/client/Client.ts index bcfe5c32..b9f98ddb 100644 --- a/src/api/resources/unstable/resources/internalArticles/client/Client.ts +++ b/src/api/resources/unstable/resources/internalArticles/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace InternalArticlesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +32,8 @@ export class InternalArticlesClient { * @param {InternalArticlesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.internalArticles.listInternalArticles() @@ -60,7 +63,7 @@ export class InternalArticlesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -101,6 +104,8 @@ export class InternalArticlesClient { * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.internalArticles.createInternalArticle({ @@ -146,9 +151,9 @@ export class InternalArticlesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -188,6 +193,8 @@ export class InternalArticlesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.internalArticles.retrieveInternalArticle({ @@ -218,11 +225,11 @@ export class InternalArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `internal_articles/${core.url.encodePathParam(id)}`, + `internal_articles/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -262,6 +269,8 @@ export class InternalArticlesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.internalArticles.updateInternalArticle({ @@ -294,14 +303,14 @@ export class InternalArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `internal_articles/${core.url.encodePathParam(id)}`, + `internal_articles/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -341,6 +350,8 @@ export class InternalArticlesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.internalArticles.deleteInternalArticle({ @@ -371,11 +382,11 @@ export class InternalArticlesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `internal_articles/${core.url.encodePathParam(id)}`, + `internal_articles/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -417,6 +428,8 @@ export class InternalArticlesClient { * @param {InternalArticlesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.internalArticles.searchInternalArticles({ @@ -435,11 +448,9 @@ export class InternalArticlesClient { requestOptions?: InternalArticlesClient.RequestOptions, ): Promise> { const { folder_id: folderId } = request; - const _queryParams: Record = {}; - if (folderId != null) { - _queryParams.folder_id = folderId; - } - + const _queryParams: Record = { + folder_id: folderId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -456,7 +467,11 @@ export class InternalArticlesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts b/src/api/resources/unstable/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts index ffd0c32d..cfb2fdda 100644 --- a/src/api/resources/unstable/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts +++ b/src/api/resources/unstable/resources/internalArticles/client/requests/UpdateInternalArticleRequestBody.ts @@ -1,13 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * id: 1, - * title: "Christmas is here!", - * body: "

New gifts in store for the jolly season

" - * } - * * @example * { * id: 1, diff --git a/src/api/resources/unstable/resources/internalArticles/exports.ts b/src/api/resources/unstable/resources/internalArticles/exports.ts new file mode 100644 index 00000000..345d0407 --- /dev/null +++ b/src/api/resources/unstable/resources/internalArticles/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { InternalArticlesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/internalArticles/types/InternalArticleListItem.ts b/src/api/resources/unstable/resources/internalArticles/types/InternalArticleListItem.ts index b906ff6f..8ce1ae40 100644 --- a/src/api/resources/unstable/resources/internalArticles/types/InternalArticleListItem.ts +++ b/src/api/resources/unstable/resources/internalArticles/types/InternalArticleListItem.ts @@ -5,21 +5,21 @@ */ export interface InternalArticleListItem { /** The type of object - `internal_article`. */ - type?: "internal_article"; + type?: "internal_article" | undefined; /** The unique identifier for the article which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The title of the article. */ - title?: string; + title?: string | undefined; /** The body of the article in HTML. */ - body?: string; + body?: string | undefined; /** The id of the owner of the article. */ - owner_id?: number; + owner_id?: number | undefined; /** The id of the author of the article. */ - author_id?: number; + author_id?: number | undefined; /** The time when the article was created. */ - created_at?: number; + created_at?: number | undefined; /** The time when the article was last updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The default locale of the article. */ - locale?: string; + locale?: string | undefined; } diff --git a/src/api/resources/unstable/resources/internalArticles/types/InternalArticleSearchResponse.ts b/src/api/resources/unstable/resources/internalArticles/types/InternalArticleSearchResponse.ts index b7790005..306fcb62 100644 --- a/src/api/resources/unstable/resources/internalArticles/types/InternalArticleSearchResponse.ts +++ b/src/api/resources/unstable/resources/internalArticles/types/InternalArticleSearchResponse.ts @@ -7,12 +7,12 @@ import type * as Intercom from "../../../../../index.js"; */ export interface InternalArticleSearchResponse { /** The type of the object - `list`. */ - type?: "list"; + type?: "list" | undefined; /** The total number of Internal Articles matching the search query */ - total_count?: number; + total_count?: number | undefined; /** An object containing the results of the search. */ - data?: InternalArticleSearchResponse.Data; - pages?: Intercom.unstable.CursorPages; + data?: InternalArticleSearchResponse.Data | undefined; + pages?: Intercom.unstable.CursorPages | undefined; } export namespace InternalArticleSearchResponse { @@ -21,6 +21,6 @@ export namespace InternalArticleSearchResponse { */ export interface Data { /** An array of Internal Article objects */ - internal_articles?: Intercom.unstable.InternalArticle[]; + internal_articles?: Intercom.unstable.InternalArticle[] | undefined; } } diff --git a/src/api/resources/unstable/resources/jobs/client/Client.ts b/src/api/resources/unstable/resources/jobs/client/Client.ts index 232af1bd..f4616265 100644 --- a/src/api/resources/unstable/resources/jobs/client/Client.ts +++ b/src/api/resources/unstable/resources/jobs/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace JobsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +33,8 @@ export class JobsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.jobs.status({ @@ -63,11 +65,11 @@ export class JobsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `jobs/status/${core.url.encodePathParam(id)}`, + `jobs/status/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/jobs/exports.ts b/src/api/resources/unstable/resources/jobs/exports.ts new file mode 100644 index 00000000..294406a7 --- /dev/null +++ b/src/api/resources/unstable/resources/jobs/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { JobsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/jobs/types/Jobs.ts b/src/api/resources/unstable/resources/jobs/types/Jobs.ts index c3e63585..7751f1e0 100644 --- a/src/api/resources/unstable/resources/jobs/types/Jobs.ts +++ b/src/api/resources/unstable/resources/jobs/types/Jobs.ts @@ -5,19 +5,19 @@ */ export interface Jobs { /** The type of the object */ - type?: "job"; + type?: "job" | undefined; /** The id of the job that's currently being processed or has completed. */ id: string; /** API endpoint URL to check the job status. */ - url?: string; + url?: string | undefined; /** The status of the job execution. */ - status?: Jobs.Status; + status?: Jobs.Status | undefined; /** The type of resource created during job execution. */ - resource_type?: string; + resource_type?: string | undefined; /** The id of the resource created during job execution (e.g. ticket id) */ - resource_id?: string; + resource_id?: string | undefined; /** The url of the resource created during job exeuction. Use this url to fetch the resource. */ - resource_url?: string; + resource_url?: string | undefined; } export namespace Jobs { diff --git a/src/api/resources/unstable/resources/macros/client/Client.ts b/src/api/resources/unstable/resources/macros/client/Client.ts index 60a0a207..5218641f 100644 --- a/src/api/resources/unstable/resources/macros/client/Client.ts +++ b/src/api/resources/unstable/resources/macros/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace MacrosClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -46,6 +46,8 @@ export class MacrosClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.macros.listMacros({ @@ -66,19 +68,11 @@ export class MacrosClient { requestOptions?: MacrosClient.RequestOptions, ): Promise> { const { per_page: perPage, starting_after: startingAfter, updated_since: updatedSince } = request; - const _queryParams: Record = {}; - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - - if (startingAfter != null) { - _queryParams.starting_after = startingAfter; - } - - if (updatedSince != null) { - _queryParams.updated_since = updatedSince.toString(); - } - + const _queryParams: Record = { + per_page: perPage, + starting_after: startingAfter, + updated_since: updatedSince, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -95,7 +89,11 @@ export class MacrosClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -157,6 +155,8 @@ export class MacrosClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.macros.getMacro({ @@ -187,11 +187,11 @@ export class MacrosClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `macros/${core.url.encodePathParam(id)}`, + `macros/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/macros/client/requests/GetMacroRequest.ts b/src/api/resources/unstable/resources/macros/client/requests/GetMacroRequest.ts index a90a0866..7804e985 100644 --- a/src/api/resources/unstable/resources/macros/client/requests/GetMacroRequest.ts +++ b/src/api/resources/unstable/resources/macros/client/requests/GetMacroRequest.ts @@ -1,21 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * id: "123" - * } - * - * @example - * { - * id: "123" - * } - * - * @example - * { - * id: "123" - * } - * * @example * { * id: "123" diff --git a/src/api/resources/unstable/resources/macros/client/requests/ListMacrosRequest.ts b/src/api/resources/unstable/resources/macros/client/requests/ListMacrosRequest.ts index caf7ed0d..8ebb98f0 100644 --- a/src/api/resources/unstable/resources/macros/client/requests/ListMacrosRequest.ts +++ b/src/api/resources/unstable/resources/macros/client/requests/ListMacrosRequest.ts @@ -1,41 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * per_page: 1, - * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd", - * updated_since: 1000000 - * } - * - * @example - * { - * per_page: 1, - * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd", - * updated_since: 1000000 - * } - * - * @example - * { - * per_page: 1, - * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd", - * updated_since: 1000000 - * } - * - * @example - * { - * per_page: 1, - * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd", - * updated_since: 1000000 - * } - * - * @example - * { - * per_page: 1, - * starting_after: "WzE3MTk0OTM3NTcuMCwgIjEyMyJd", - * updated_since: 1000000 - * } - * * @example * { * per_page: 1, diff --git a/src/api/resources/unstable/resources/macros/exports.ts b/src/api/resources/unstable/resources/macros/exports.ts new file mode 100644 index 00000000..d5e8376f --- /dev/null +++ b/src/api/resources/unstable/resources/macros/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { MacrosClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/macros/types/Macro.ts b/src/api/resources/unstable/resources/macros/types/Macro.ts index b7941f1a..25c36207 100644 --- a/src/api/resources/unstable/resources/macros/types/Macro.ts +++ b/src/api/resources/unstable/resources/macros/types/Macro.ts @@ -5,25 +5,25 @@ */ export interface Macro { /** String representing the object's type. Always has the value `macro`. */ - type?: "macro"; + type?: "macro" | undefined; /** The unique identifier for the macro. */ - id?: string; + id?: string | undefined; /** The name of the macro. */ - name?: string; + name?: string | undefined; /** The body of the macro in HTML format with placeholders transformed to XML-like format. */ - body?: string; + body?: string | undefined; /** The plain text version of the macro body with original Intercom placeholder format. */ - body_text?: string; + body_text?: string | undefined; /** The time the macro was created in ISO 8601 format. */ - created_at?: string; + created_at?: string | undefined; /** The time the macro was last updated in ISO 8601 format. */ - updated_at?: string; + updated_at?: string | undefined; /** Who can view this macro. */ - visible_to?: Macro.VisibleTo; + visible_to?: Macro.VisibleTo | undefined; /** The team IDs that can view this macro when visible_to is set to specific_teams. */ - visible_to_team_ids?: string[]; + visible_to_team_ids?: string[] | undefined; /** Where the macro is available for use. */ - available_on?: Macro.AvailableOn.Item[]; + available_on?: Macro.AvailableOn.Item[] | undefined; } export namespace Macro { diff --git a/src/api/resources/unstable/resources/macros/types/MacroList.ts b/src/api/resources/unstable/resources/macros/types/MacroList.ts index 0694b02f..60895d5c 100644 --- a/src/api/resources/unstable/resources/macros/types/MacroList.ts +++ b/src/api/resources/unstable/resources/macros/types/MacroList.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../../../../../index.js"; */ export interface MacroList { /** Always list */ - type?: "list"; + type?: "list" | undefined; /** The list of macro objects */ - data?: (Intercom.unstable.Macro | undefined)[]; + data?: (Intercom.unstable.Macro | undefined)[] | undefined; /** Pagination information */ - pages?: MacroList.Pages; + pages?: MacroList.Pages | undefined; } export namespace MacroList { @@ -20,11 +20,11 @@ export namespace MacroList { */ export interface Pages { /** The type of pagination */ - type?: "pages"; + type?: "pages" | undefined; /** Number of results per page */ - per_page?: number; + per_page?: number | undefined; /** Cursor for the next page */ - next?: Pages.Next; + next?: Pages.Next | undefined; } export namespace Pages { @@ -33,7 +33,7 @@ export namespace MacroList { */ export interface Next { /** Base64-encoded cursor containing [updated_at, id] for pagination */ - starting_after?: string; + starting_after?: string | undefined; } } } diff --git a/src/api/resources/unstable/resources/messages/client/Client.ts b/src/api/resources/unstable/resources/messages/client/Client.ts index 95d1513f..1333cf41 100644 --- a/src/api/resources/unstable/resources/messages/client/Client.ts +++ b/src/api/resources/unstable/resources/messages/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace MessagesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -38,13 +39,15 @@ export class MessagesClient { * > * > As this is a message, there will be no conversation present until the contact responds. Once they do, you will have to search for a contact's conversations with the id of the message. * - * @param {Intercom.unstable.CreateMessageRequest | undefined} request + * @param {Intercom.unstable.CreateMessageRequest} request * @param {MessagesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.messages.createMessage({ @@ -203,14 +206,14 @@ export class MessagesClient { * }) */ public createMessage( - request?: Intercom.unstable.CreateMessageRequest | undefined, + request?: Intercom.unstable.CreateMessageRequest, requestOptions?: MessagesClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__createMessage(request, requestOptions)); } private async __createMessage( - request?: Intercom.unstable.CreateMessageRequest | undefined, + request?: Intercom.unstable.CreateMessageRequest, requestOptions?: MessagesClient.RequestOptions, ): Promise> { const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); @@ -230,9 +233,9 @@ export class MessagesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request != null ? request : undefined, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -288,6 +291,8 @@ export class MessagesClient { * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.InternalServerError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.messages.getWhatsAppMessageStatus({ @@ -308,16 +313,11 @@ export class MessagesClient { requestOptions?: MessagesClient.RequestOptions, ): Promise> { const { ruleset_id: rulesetId, per_page: perPage, starting_after: startingAfter } = request; - const _queryParams: Record = {}; - _queryParams.ruleset_id = rulesetId; - if (perPage != null) { - _queryParams.per_page = perPage.toString(); - } - - if (startingAfter != null) { - _queryParams.starting_after = startingAfter; - } - + const _queryParams: Record = { + ruleset_id: rulesetId, + per_page: perPage, + starting_after: startingAfter, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -334,7 +334,11 @@ export class MessagesClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/messages/exports.ts b/src/api/resources/unstable/resources/messages/exports.ts new file mode 100644 index 00000000..afa2f7cd --- /dev/null +++ b/src/api/resources/unstable/resources/messages/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { MessagesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/messages/types/Message.ts b/src/api/resources/unstable/resources/messages/types/Message.ts index 14710453..141837e1 100644 --- a/src/api/resources/unstable/resources/messages/types/Message.ts +++ b/src/api/resources/unstable/resources/messages/types/Message.ts @@ -11,13 +11,13 @@ export interface Message { /** The time the conversation was created. */ created_at: number; /** The subject of the message. Only present if message_type: email. */ - subject?: string; + subject?: string | undefined; /** The message body, which may contain HTML. */ body: string; /** The type of message that was sent. Can be email, inapp, facebook, twitter, sms or whatsapp. */ message_type: Message.MessageType; /** The associated conversation_id */ - conversation_id?: string; + conversation_id?: string | undefined; } export namespace Message { diff --git a/src/api/resources/unstable/resources/news/client/Client.ts b/src/api/resources/unstable/resources/news/client/Client.ts index a0463196..7a238573 100644 --- a/src/api/resources/unstable/resources/news/client/Client.ts +++ b/src/api/resources/unstable/resources/news/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace NewsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +32,8 @@ export class NewsClient { * @param {NewsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.news.listNewsItems() @@ -60,7 +63,7 @@ export class NewsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -97,6 +100,8 @@ export class NewsClient { * @param {NewsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.news.createNewsItem({ @@ -141,9 +146,9 @@ export class NewsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -181,6 +186,8 @@ export class NewsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.news.retrieveNewsItem({ @@ -211,11 +218,11 @@ export class NewsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${core.url.encodePathParam(id)}`, + `news/news_items/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -253,6 +260,8 @@ export class NewsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.news.updateNewsItem({ @@ -300,14 +309,14 @@ export class NewsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${core.url.encodePathParam(id)}`, + `news/news_items/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -347,6 +356,8 @@ export class NewsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.news.deleteNewsItem({ @@ -377,11 +388,11 @@ export class NewsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/news_items/${core.url.encodePathParam(id)}`, + `news/news_items/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -420,6 +431,8 @@ export class NewsClient { * @param {NewsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.news.listLiveNewsfeedItems({ @@ -450,11 +463,11 @@ export class NewsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/newsfeeds/${core.url.encodePathParam(id)}/items`, + `news/newsfeeds/${core.url.encodePathParam(id, errors.IntercomError)}/items`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -490,6 +503,8 @@ export class NewsClient { * @param {NewsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.news.listNewsfeeds() @@ -519,7 +534,7 @@ export class NewsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -556,6 +571,8 @@ export class NewsClient { * @param {NewsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.news.retrieveNewsfeed({ @@ -586,11 +603,11 @@ export class NewsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `news/newsfeeds/${core.url.encodePathParam(id)}`, + `news/newsfeeds/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/news/exports.ts b/src/api/resources/unstable/resources/news/exports.ts new file mode 100644 index 00000000..8a1a6b64 --- /dev/null +++ b/src/api/resources/unstable/resources/news/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { NewsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/news/types/NewsItem.ts b/src/api/resources/unstable/resources/news/types/NewsItem.ts index a5ecc130..bd2afd8c 100644 --- a/src/api/resources/unstable/resources/news/types/NewsItem.ts +++ b/src/api/resources/unstable/resources/news/types/NewsItem.ts @@ -7,33 +7,33 @@ import type * as Intercom from "../../../../../index.js"; */ export interface NewsItem { /** The type of object. */ - type?: "news-item"; + type?: "news-item" | undefined; /** The unique identifier for the news item which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The id of the workspace which the news item belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The title of the news item. */ - title?: string; + title?: string | undefined; /** The news item body, which may contain HTML. */ - body?: string; + body?: string | undefined; /** The id of the sender of the news item. Must be a teammate on the workspace. */ - sender_id?: number; + sender_id?: number | undefined; /** News items will not be visible to your users in the assigned newsfeeds until they are set live. */ - state?: NewsItem.State; + state?: NewsItem.State | undefined; /** A list of newsfeed_assignments to assign to the specified newsfeed. */ - newsfeed_assignments?: Intercom.unstable.NewsfeedAssignment[]; + newsfeed_assignments?: Intercom.unstable.NewsfeedAssignment[] | undefined; /** Label names displayed to users to categorize the news item. */ - labels?: (string | undefined)[]; + labels?: (string | undefined)[] | undefined; /** URL of the image used as cover. Must have .jpg or .png extension. */ - cover_image_url?: string; + cover_image_url?: string | undefined; /** Ordered list of emoji reactions to the news item. When empty, reactions are disabled. */ - reactions?: (string | undefined)[]; + reactions?: (string | undefined)[] | undefined; /** When set to true, the news item will appear in the messenger newsfeed without showing a notification badge. */ - deliver_silently?: boolean; + deliver_silently?: boolean | undefined; /** Timestamp for when the news item was created. */ - created_at?: number; + created_at?: number | undefined; /** Timestamp for when the news item was last updated. */ - updated_at?: number; + updated_at?: number | undefined; } export namespace NewsItem { diff --git a/src/api/resources/unstable/resources/news/types/Newsfeed.ts b/src/api/resources/unstable/resources/news/types/Newsfeed.ts index a42f6306..7a42dee7 100644 --- a/src/api/resources/unstable/resources/news/types/Newsfeed.ts +++ b/src/api/resources/unstable/resources/news/types/Newsfeed.ts @@ -7,13 +7,13 @@ */ export interface Newsfeed { /** The unique identifier for the newsfeed which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The type of object. */ - type?: "newsfeed"; + type?: "newsfeed" | undefined; /** The name of the newsfeed. This name will never be visible to your users. */ - name?: string; + name?: string | undefined; /** Timestamp for when the newsfeed was created. */ - created_at?: number; + created_at?: number | undefined; /** Timestamp for when the newsfeed was last updated. */ - updated_at?: number; + updated_at?: number | undefined; } diff --git a/src/api/resources/unstable/resources/news/types/NewsfeedAssignment.ts b/src/api/resources/unstable/resources/news/types/NewsfeedAssignment.ts index 064483c9..5f70a65a 100644 --- a/src/api/resources/unstable/resources/news/types/NewsfeedAssignment.ts +++ b/src/api/resources/unstable/resources/news/types/NewsfeedAssignment.ts @@ -5,7 +5,7 @@ */ export interface NewsfeedAssignment { /** The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article). */ - newsfeed_id?: number; + newsfeed_id?: number | undefined; /** Publish date of the news item on the newsfeed, use this field if you want to set a publish date in the past (e.g. when importing existing news items). On write, this field will be ignored if the news item state is "draft". */ - published_at?: number; + published_at?: number | undefined; } diff --git a/src/api/resources/unstable/resources/notes/client/Client.ts b/src/api/resources/unstable/resources/notes/client/Client.ts index 6daafede..cf421f89 100644 --- a/src/api/resources/unstable/resources/notes/client/Client.ts +++ b/src/api/resources/unstable/resources/notes/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace NotesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +33,8 @@ export class NotesClient { * @param {NotesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.notes.listCompanyNotes({ @@ -62,11 +65,11 @@ export class NotesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `companies/${core.url.encodePathParam(id)}/notes`, + `companies/${core.url.encodePathParam(id, errors.IntercomError)}/notes`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -100,6 +103,8 @@ export class NotesClient { * @param {NotesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.notes.listNotes({ @@ -130,11 +135,11 @@ export class NotesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}/notes`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}/notes`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -168,6 +173,8 @@ export class NotesClient { * @param {NotesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.notes.createNote({ @@ -217,14 +224,14 @@ export class NotesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(id)}/notes`, + `contacts/${core.url.encodePathParam(id, errors.IntercomError)}/notes`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -259,6 +266,8 @@ export class NotesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.notes.retrieveNote({ @@ -289,11 +298,11 @@ export class NotesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `notes/${core.url.encodePathParam(id)}`, + `notes/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/notes/exports.ts b/src/api/resources/unstable/resources/notes/exports.ts new file mode 100644 index 00000000..13f20ba2 --- /dev/null +++ b/src/api/resources/unstable/resources/notes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { NotesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/notes/types/CompanyNote.ts b/src/api/resources/unstable/resources/notes/types/CompanyNote.ts index d63295c5..98e9d850 100644 --- a/src/api/resources/unstable/resources/notes/types/CompanyNote.ts +++ b/src/api/resources/unstable/resources/notes/types/CompanyNote.ts @@ -7,17 +7,17 @@ import type * as Intercom from "../../../../../index.js"; */ export interface CompanyNote { /** String representing the object's type. Always has the value `note`. */ - type?: string; + type?: string | undefined; /** The id of the note. */ - id?: string; + id?: string | undefined; /** The time the note was created. */ - created_at?: number; + created_at?: number | undefined; /** Represents the company that the note was created about. */ - company?: CompanyNote.Company; + company?: CompanyNote.Company | undefined; /** Optional. Represents the Admin that created the note. */ - author?: Intercom.unstable.Admin; + author?: Intercom.unstable.Admin | undefined; /** The body text of the note. */ - body?: string; + body?: string | undefined; } export namespace CompanyNote { @@ -26,8 +26,8 @@ export namespace CompanyNote { */ export interface Company { /** String representing the object's type. Always has the value `company`. */ - type?: string; + type?: string | undefined; /** The id of the company. */ - id?: string; + id?: string | undefined; } } diff --git a/src/api/resources/unstable/resources/notes/types/Note.ts b/src/api/resources/unstable/resources/notes/types/Note.ts index 571bce49..fee483e7 100644 --- a/src/api/resources/unstable/resources/notes/types/Note.ts +++ b/src/api/resources/unstable/resources/notes/types/Note.ts @@ -7,17 +7,17 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Note { /** String representing the object's type. Always has the value `note`. */ - type?: string; + type?: string | undefined; /** The id of the note. */ - id?: string; + id?: string | undefined; /** The time the note was created. */ - created_at?: number; + created_at?: number | undefined; /** Represents the contact that the note was created about. */ - contact?: Note.Contact; + contact?: Note.Contact | undefined; /** Optional. Represents the Admin that created the note. */ - author?: Intercom.unstable.Admin; + author?: Intercom.unstable.Admin | undefined; /** The body text of the note. */ - body?: string; + body?: string | undefined; } export namespace Note { @@ -26,8 +26,8 @@ export namespace Note { */ export interface Contact { /** String representing the object's type. Always has the value `contact`. */ - type?: string; + type?: string | undefined; /** The id of the contact. */ - id?: string; + id?: string | undefined; } } diff --git a/src/api/resources/unstable/resources/segments/client/Client.ts b/src/api/resources/unstable/resources/segments/client/Client.ts index 64d7c4fb..e70caff8 100644 --- a/src/api/resources/unstable/resources/segments/client/Client.ts +++ b/src/api/resources/unstable/resources/segments/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace SegmentsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +32,8 @@ export class SegmentsClient { * @param {SegmentsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.segments.listSegments({ @@ -50,11 +52,9 @@ export class SegmentsClient { requestOptions?: SegmentsClient.RequestOptions, ): Promise> { const { include_count: includeCount } = request; - const _queryParams: Record = {}; - if (includeCount != null) { - _queryParams.include_count = includeCount.toString(); - } - + const _queryParams: Record = { + include_count: includeCount, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -71,7 +71,11 @@ export class SegmentsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -109,6 +113,8 @@ export class SegmentsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.segments.retrieveSegment({ @@ -139,11 +145,11 @@ export class SegmentsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `segments/${core.url.encodePathParam(id)}`, + `segments/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/segments/exports.ts b/src/api/resources/unstable/resources/segments/exports.ts new file mode 100644 index 00000000..c0714387 --- /dev/null +++ b/src/api/resources/unstable/resources/segments/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { SegmentsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/segments/types/Segment.ts b/src/api/resources/unstable/resources/segments/types/Segment.ts index 5fbb6b53..9a6be1d5 100644 --- a/src/api/resources/unstable/resources/segments/types/Segment.ts +++ b/src/api/resources/unstable/resources/segments/types/Segment.ts @@ -5,19 +5,19 @@ */ export interface Segment { /** The type of object. */ - type?: "segment"; + type?: "segment" | undefined; /** The unique identifier representing the segment. */ - id?: string; + id?: string | undefined; /** The name of the segment. */ - name?: string; + name?: string | undefined; /** The time the segment was created. */ - created_at?: number; + created_at?: number | undefined; /** The time the segment was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** Type of the contact: contact (lead) or user. */ - person_type?: Segment.PersonType; + person_type?: Segment.PersonType | undefined; /** The number of items in the user segment. It's returned when `include_count=true` is included in the request. */ - count?: number; + count?: number | undefined; } export namespace Segment { diff --git a/src/api/resources/unstable/resources/subscriptionTypes/client/Client.ts b/src/api/resources/unstable/resources/subscriptionTypes/client/Client.ts index b43baf9e..bdffdc3b 100644 --- a/src/api/resources/unstable/resources/subscriptionTypes/client/Client.ts +++ b/src/api/resources/unstable/resources/subscriptionTypes/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace SubscriptionTypesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -39,6 +40,8 @@ export class SubscriptionTypesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.subscriptionTypes.attachSubscriptionTypeToContact({ @@ -78,14 +81,14 @@ export class SubscriptionTypesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/subscriptions`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/subscriptions`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -130,6 +133,8 @@ export class SubscriptionTypesClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.subscriptionTypes.detachSubscriptionTypeToContact({ @@ -161,11 +166,11 @@ export class SubscriptionTypesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/subscriptions/${core.url.encodePathParam(id)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/subscriptions/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -208,6 +213,8 @@ export class SubscriptionTypesClient { * @param {SubscriptionTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.subscriptionTypes.listSubscriptionTypes() @@ -237,7 +244,7 @@ export class SubscriptionTypesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/subscriptionTypes/client/requests/AttachSubscriptionTypeToContactRequest.ts b/src/api/resources/unstable/resources/subscriptionTypes/client/requests/AttachSubscriptionTypeToContactRequest.ts index 18911f33..a8c8140e 100644 --- a/src/api/resources/unstable/resources/subscriptionTypes/client/requests/AttachSubscriptionTypeToContactRequest.ts +++ b/src/api/resources/unstable/resources/subscriptionTypes/client/requests/AttachSubscriptionTypeToContactRequest.ts @@ -11,13 +11,6 @@ * @example * { * contact_id: "63a07ddf05a32042dffac965", - * id: "37846", - * consent_type: "opt_in" - * } - * - * @example - * { - * contact_id: "63a07ddf05a32042dffac965", * id: "invalid_id", * consent_type: "opt_in" * } diff --git a/src/api/resources/unstable/resources/subscriptionTypes/exports.ts b/src/api/resources/unstable/resources/subscriptionTypes/exports.ts new file mode 100644 index 00000000..92ba3dd0 --- /dev/null +++ b/src/api/resources/unstable/resources/subscriptionTypes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { SubscriptionTypesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/subscriptionTypes/types/SubscriptionType.ts b/src/api/resources/unstable/resources/subscriptionTypes/types/SubscriptionType.ts index 3867aa94..6bae4674 100644 --- a/src/api/resources/unstable/resources/subscriptionTypes/types/SubscriptionType.ts +++ b/src/api/resources/unstable/resources/subscriptionTypes/types/SubscriptionType.ts @@ -7,18 +7,18 @@ import type * as Intercom from "../../../../../index.js"; */ export interface SubscriptionType { /** The type of the object - subscription */ - type?: string; + type?: string | undefined; /** The unique identifier representing the subscription type. */ - id?: string; + id?: string | undefined; /** The state of the subscription type. */ - state?: SubscriptionType.State; - default_translation?: Intercom.unstable.Translation; + state?: SubscriptionType.State | undefined; + default_translation?: Intercom.unstable.Translation | undefined; /** An array of translations objects with the localised version of the subscription type in each available locale within your translation settings. */ - translations?: Intercom.unstable.Translation[]; + translations?: Intercom.unstable.Translation[] | undefined; /** Describes the type of consent. */ - consent_type?: SubscriptionType.ConsentType; + consent_type?: SubscriptionType.ConsentType | undefined; /** The message types that this subscription supports - can contain `email` or `sms_message`. */ - content_types?: SubscriptionType.ContentTypes.Item[]; + content_types?: SubscriptionType.ContentTypes.Item[] | undefined; } export namespace SubscriptionType { diff --git a/src/api/resources/unstable/resources/switch/client/Client.ts b/src/api/resources/unstable/resources/switch/client/Client.ts index 0c95ab0e..5ef57a6d 100644 --- a/src/api/resources/unstable/resources/switch/client/Client.ts +++ b/src/api/resources/unstable/resources/switch/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace SwitchClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -37,6 +38,8 @@ export class SwitchClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.UnprocessableEntityError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.switch.createPhoneSwitch({ @@ -71,9 +74,9 @@ export class SwitchClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/switch/exports.ts b/src/api/resources/unstable/resources/switch/exports.ts new file mode 100644 index 00000000..216a2b20 --- /dev/null +++ b/src/api/resources/unstable/resources/switch/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { SwitchClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/tags/client/Client.ts b/src/api/resources/unstable/resources/tags/client/Client.ts index 681b40df..3dd1fa7b 100644 --- a/src/api/resources/unstable/resources/tags/client/Client.ts +++ b/src/api/resources/unstable/resources/tags/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace TagsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +34,8 @@ export class TagsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.attachTagToContact({ @@ -70,14 +73,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/tags`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/tags`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -117,6 +120,8 @@ export class TagsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.detachTagFromContact({ @@ -148,11 +153,11 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `contacts/${core.url.encodePathParam(contactId)}/tags/${core.url.encodePathParam(id)}`, + `contacts/${core.url.encodePathParam(contactId, errors.IntercomError)}/tags/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -197,6 +202,8 @@ export class TagsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.attachTagToConversation({ @@ -229,14 +236,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/tags`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/tags`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -281,6 +288,8 @@ export class TagsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.detachTagFromConversation({ @@ -313,14 +322,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `conversations/${core.url.encodePathParam(conversationId)}/tags/${core.url.encodePathParam(id)}`, + `conversations/${core.url.encodePathParam(conversationId, errors.IntercomError)}/tags/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -364,6 +373,8 @@ export class TagsClient { * @param {TagsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.listTags() @@ -391,7 +402,7 @@ export class TagsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -442,6 +453,8 @@ export class TagsClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.createTag({ @@ -497,9 +510,9 @@ export class TagsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -542,6 +555,8 @@ export class TagsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.findTag({ @@ -572,11 +587,11 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tags/${core.url.encodePathParam(id)}`, + `tags/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -617,6 +632,8 @@ export class TagsClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.deleteTag({ @@ -647,11 +664,11 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tags/${core.url.encodePathParam(id)}`, + `tags/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -693,6 +710,8 @@ export class TagsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.attachTagToTicket({ @@ -725,14 +744,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(ticketId)}/tags`, + `tickets/${core.url.encodePathParam(ticketId, errors.IntercomError)}/tags`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -772,6 +791,8 @@ export class TagsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tags.detachTagFromTicket({ @@ -804,14 +825,14 @@ export class TagsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(ticketId)}/tags/${core.url.encodePathParam(id)}`, + `tickets/${core.url.encodePathParam(ticketId, errors.IntercomError)}/tags/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/tags/client/requests/AttachTagToContactRequest.ts b/src/api/resources/unstable/resources/tags/client/requests/AttachTagToContactRequest.ts index 94218c40..66028d28 100644 --- a/src/api/resources/unstable/resources/tags/client/requests/AttachTagToContactRequest.ts +++ b/src/api/resources/unstable/resources/tags/client/requests/AttachTagToContactRequest.ts @@ -10,12 +10,6 @@ * @example * { * contact_id: "63a07ddf05a32042dffac965", - * id: "7522907" - * } - * - * @example - * { - * contact_id: "63a07ddf05a32042dffac965", * id: "123" * } */ diff --git a/src/api/resources/unstable/resources/tags/client/requests/AttachTagToConversationRequest.ts b/src/api/resources/unstable/resources/tags/client/requests/AttachTagToConversationRequest.ts index c6084c34..9b5cd506 100644 --- a/src/api/resources/unstable/resources/tags/client/requests/AttachTagToConversationRequest.ts +++ b/src/api/resources/unstable/resources/tags/client/requests/AttachTagToConversationRequest.ts @@ -1,13 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * conversation_id: "64619700005694", - * id: "7522907", - * admin_id: "780" - * } - * * @example * { * conversation_id: "64619700005694", diff --git a/src/api/resources/unstable/resources/tags/client/requests/AttachTagToTicketRequest.ts b/src/api/resources/unstable/resources/tags/client/requests/AttachTagToTicketRequest.ts index 4082336b..6851785c 100644 --- a/src/api/resources/unstable/resources/tags/client/requests/AttachTagToTicketRequest.ts +++ b/src/api/resources/unstable/resources/tags/client/requests/AttachTagToTicketRequest.ts @@ -1,13 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * ticket_id: "64619700005694", - * id: "7522907", - * admin_id: "780" - * } - * * @example * { * ticket_id: "64619700005694", diff --git a/src/api/resources/unstable/resources/tags/client/requests/DetachTagFromConversationRequest.ts b/src/api/resources/unstable/resources/tags/client/requests/DetachTagFromConversationRequest.ts index 9cc3452f..8dfca785 100644 --- a/src/api/resources/unstable/resources/tags/client/requests/DetachTagFromConversationRequest.ts +++ b/src/api/resources/unstable/resources/tags/client/requests/DetachTagFromConversationRequest.ts @@ -1,20 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * conversation_id: "64619700005694", - * id: "7522907", - * admin_id: "123" - * } - * - * @example - * { - * conversation_id: "64619700005694", - * id: "7522907", - * admin_id: "123" - * } - * * @example * { * conversation_id: "64619700005694", diff --git a/src/api/resources/unstable/resources/tags/client/requests/DetachTagFromTicketRequest.ts b/src/api/resources/unstable/resources/tags/client/requests/DetachTagFromTicketRequest.ts index 9c6e58ac..b24e0222 100644 --- a/src/api/resources/unstable/resources/tags/client/requests/DetachTagFromTicketRequest.ts +++ b/src/api/resources/unstable/resources/tags/client/requests/DetachTagFromTicketRequest.ts @@ -1,20 +1,6 @@ // This file was auto-generated by Fern from our API Definition. /** - * @example - * { - * ticket_id: "64619700005694", - * id: "7522907", - * admin_id: "123" - * } - * - * @example - * { - * ticket_id: "64619700005694", - * id: "7522907", - * admin_id: "123" - * } - * * @example * { * ticket_id: "64619700005694", diff --git a/src/api/resources/unstable/resources/tags/exports.ts b/src/api/resources/unstable/resources/tags/exports.ts new file mode 100644 index 00000000..631b2f7d --- /dev/null +++ b/src/api/resources/unstable/resources/tags/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TagsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/tags/types/Tag.ts b/src/api/resources/unstable/resources/tags/types/Tag.ts index f62cbefb..40a2aab9 100644 --- a/src/api/resources/unstable/resources/tags/types/Tag.ts +++ b/src/api/resources/unstable/resources/tags/types/Tag.ts @@ -7,12 +7,12 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Tag { /** value is "tag" */ - type?: string; + type?: string | undefined; /** The id of the tag */ - id?: string; + id?: string | undefined; /** The name of the tag */ - name?: string; + name?: string | undefined; /** The time when the tag was applied to the object */ - applied_at?: number; - applied_by?: Intercom.unstable.Reference; + applied_at?: number | undefined; + applied_by?: Intercom.unstable.Reference | undefined; } diff --git a/src/api/resources/unstable/resources/tags/types/TagBasic.ts b/src/api/resources/unstable/resources/tags/types/TagBasic.ts index 8e8b815d..188e9706 100644 --- a/src/api/resources/unstable/resources/tags/types/TagBasic.ts +++ b/src/api/resources/unstable/resources/tags/types/TagBasic.ts @@ -5,9 +5,9 @@ */ export interface TagBasic { /** value is "tag" */ - type?: string; + type?: string | undefined; /** The id of the tag */ - id?: string; + id?: string | undefined; /** The name of the tag */ - name?: string; + name?: string | undefined; } diff --git a/src/api/resources/unstable/resources/teams/client/Client.ts b/src/api/resources/unstable/resources/teams/client/Client.ts index c83adaf9..db1aaebf 100644 --- a/src/api/resources/unstable/resources/teams/client/Client.ts +++ b/src/api/resources/unstable/resources/teams/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace TeamsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +31,8 @@ export class TeamsClient { * @param {TeamsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.teams.listTeams() @@ -60,7 +62,7 @@ export class TeamsClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -98,6 +100,8 @@ export class TeamsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.teams.retrieveTeam({ @@ -128,11 +132,11 @@ export class TeamsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `teams/${core.url.encodePathParam(id)}`, + `teams/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/teams/exports.ts b/src/api/resources/unstable/resources/teams/exports.ts new file mode 100644 index 00000000..ca1debc9 --- /dev/null +++ b/src/api/resources/unstable/resources/teams/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TeamsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/teams/types/Team.ts b/src/api/resources/unstable/resources/teams/types/Team.ts index 412cc0d0..67ddd85d 100644 --- a/src/api/resources/unstable/resources/teams/types/Team.ts +++ b/src/api/resources/unstable/resources/teams/types/Team.ts @@ -7,12 +7,12 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Team { /** Value is always "team" */ - type?: string; + type?: string | undefined; /** The id of the team */ - id?: string; + id?: string | undefined; /** The name of the team */ - name?: string; + name?: string | undefined; /** The list of admin IDs that are a part of the team. */ - admin_ids?: number[]; - admin_priority_level?: Intercom.unstable.AdminPriorityLevel; + admin_ids?: number[] | undefined; + admin_priority_level?: Intercom.unstable.AdminPriorityLevel | undefined; } diff --git a/src/api/resources/unstable/resources/ticketStates/client/Client.ts b/src/api/resources/unstable/resources/ticketStates/client/Client.ts index 84960f00..3b76aedd 100644 --- a/src/api/resources/unstable/resources/ticketStates/client/Client.ts +++ b/src/api/resources/unstable/resources/ticketStates/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace TicketStatesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +31,8 @@ export class TicketStatesClient { * @param {TicketStatesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.ticketStates.listTicketStates() @@ -60,7 +62,7 @@ export class TicketStatesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/ticketStates/exports.ts b/src/api/resources/unstable/resources/ticketStates/exports.ts new file mode 100644 index 00000000..cfe67a96 --- /dev/null +++ b/src/api/resources/unstable/resources/ticketStates/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TicketStatesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/ticketTypeAttributes/client/Client.ts b/src/api/resources/unstable/resources/ticketTypeAttributes/client/Client.ts index fe5a1095..e3c06c52 100644 --- a/src/api/resources/unstable/resources/ticketTypeAttributes/client/Client.ts +++ b/src/api/resources/unstable/resources/ticketTypeAttributes/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace TicketTypeAttributesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -32,6 +33,8 @@ export class TicketTypeAttributesClient { * @param {TicketTypeAttributesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.ticketTypeAttributes.createTicketTypeAttribute({ @@ -66,14 +69,14 @@ export class TicketTypeAttributesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${core.url.encodePathParam(ticketTypeId)}/attributes`, + `ticket_types/${core.url.encodePathParam(ticketTypeId, errors.IntercomError)}/attributes`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -118,6 +121,8 @@ export class TicketTypeAttributesClient { * @param {TicketTypeAttributesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.ticketTypeAttributes.updateTicketTypeAttribute({ @@ -150,14 +155,14 @@ export class TicketTypeAttributesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${core.url.encodePathParam(ticketTypeId)}/attributes/${core.url.encodePathParam(id)}`, + `ticket_types/${core.url.encodePathParam(ticketTypeId, errors.IntercomError)}/attributes/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/ticketTypeAttributes/client/requests/index.ts b/src/api/resources/unstable/resources/ticketTypeAttributes/client/requests/index.ts index 2a2ffb63..43a259fb 100644 --- a/src/api/resources/unstable/resources/ticketTypeAttributes/client/requests/index.ts +++ b/src/api/resources/unstable/resources/ticketTypeAttributes/client/requests/index.ts @@ -1,2 +1,2 @@ -export type { CreateTicketTypeAttributeRequest } from "./CreateTicketTypeAttributeRequest.js"; +export { CreateTicketTypeAttributeRequest } from "./CreateTicketTypeAttributeRequest.js"; export type { UpdateTicketTypeAttributeRequest } from "./UpdateTicketTypeAttributeRequest.js"; diff --git a/src/api/resources/unstable/resources/ticketTypeAttributes/exports.ts b/src/api/resources/unstable/resources/ticketTypeAttributes/exports.ts new file mode 100644 index 00000000..22f153ec --- /dev/null +++ b/src/api/resources/unstable/resources/ticketTypeAttributes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TicketTypeAttributesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/ticketTypes/client/Client.ts b/src/api/resources/unstable/resources/ticketTypes/client/Client.ts index 1d1adfed..f2e489d6 100644 --- a/src/api/resources/unstable/resources/ticketTypes/client/Client.ts +++ b/src/api/resources/unstable/resources/ticketTypes/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace TicketTypesClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -31,6 +32,8 @@ export class TicketTypesClient { * @param {TicketTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.ticketTypes.listTicketTypes() @@ -60,7 +63,7 @@ export class TicketTypesClient { ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -101,6 +104,8 @@ export class TicketTypesClient { * @param {TicketTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.ticketTypes.createTicketType({ @@ -135,9 +140,9 @@ export class TicketTypesClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -177,6 +182,8 @@ export class TicketTypesClient { * @param {TicketTypesClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.ticketTypes.getTicketType({ @@ -207,11 +214,11 @@ export class TicketTypesClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `ticket_types/${core.url.encodePathParam(id)}`, + `ticket_types/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/ticketTypes/exports.ts b/src/api/resources/unstable/resources/ticketTypes/exports.ts new file mode 100644 index 00000000..51cd8b0d --- /dev/null +++ b/src/api/resources/unstable/resources/ticketTypes/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TicketTypesClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/tickets/client/Client.ts b/src/api/resources/unstable/resources/tickets/client/Client.ts index 4c28d71b..846f75e0 100644 --- a/src/api/resources/unstable/resources/tickets/client/Client.ts +++ b/src/api/resources/unstable/resources/tickets/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace TicketsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -34,6 +35,8 @@ export class TicketsClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tickets.replyTicket({ @@ -109,14 +112,14 @@ export class TicketsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(id)}/reply`, + `tickets/${core.url.encodePathParam(id, errors.IntercomError)}/reply`, ), method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -158,6 +161,8 @@ export class TicketsClient { * * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tickets.enqueueCreateTicket({ @@ -195,9 +200,9 @@ export class TicketsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -236,6 +241,8 @@ export class TicketsClient { * @param {TicketsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tickets.getTicket({ @@ -266,11 +273,11 @@ export class TicketsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(id)}`, + `tickets/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -309,6 +316,8 @@ export class TicketsClient { * @throws {@link Intercom.unstable.BadRequestError} * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tickets.updateTicket({ @@ -366,14 +375,14 @@ export class TicketsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(id)}`, + `tickets/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: _body, + body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -415,6 +424,8 @@ export class TicketsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.tickets.deleteTicket({ @@ -445,11 +456,11 @@ export class TicketsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `tickets/${core.url.encodePathParam(id)}`, + `tickets/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "DELETE", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -558,6 +569,9 @@ export class TicketsClient { * @param {Intercom.unstable.SearchRequest} request * @param {TicketsClient.RequestOptions} requestOptions - Request-specific configuration. * + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} + * * @example * await client.unstable.tickets.searchTickets({ * query: { @@ -601,9 +615,9 @@ export class TicketsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/tickets/client/requests/UpdateTicketRequest.ts b/src/api/resources/unstable/resources/tickets/client/requests/UpdateTicketRequest.ts index 63d68d08..7a8b4e0e 100644 --- a/src/api/resources/unstable/resources/tickets/client/requests/UpdateTicketRequest.ts +++ b/src/api/resources/unstable/resources/tickets/client/requests/UpdateTicketRequest.ts @@ -30,18 +30,6 @@ * @example * { * id: "id", - * ticket_attributes: { - * "_default_title_": "example", - * "_default_description_": "there is a problem" - * }, - * ticket_state_id: "123", - * admin_id: 991268011, - * assignee_id: "123" - * } - * - * @example - * { - * id: "id", * ticket_state_id: "123" * } */ diff --git a/src/api/resources/unstable/resources/tickets/exports.ts b/src/api/resources/unstable/resources/tickets/exports.ts new file mode 100644 index 00000000..6b2593b8 --- /dev/null +++ b/src/api/resources/unstable/resources/tickets/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { TicketsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/tickets/types/DeleteTicketResponse.ts b/src/api/resources/unstable/resources/tickets/types/DeleteTicketResponse.ts index cdad7f2d..a34c0b39 100644 --- a/src/api/resources/unstable/resources/tickets/types/DeleteTicketResponse.ts +++ b/src/api/resources/unstable/resources/tickets/types/DeleteTicketResponse.ts @@ -5,9 +5,9 @@ */ export interface DeleteTicketResponse { /** The unique identifier for the ticket. */ - id?: string; + id?: string | undefined; /** always ticket */ - object?: "ticket"; + object?: "ticket" | undefined; /** Whether the ticket is deleted or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/resources/tickets/types/Ticket.ts b/src/api/resources/unstable/resources/tickets/types/Ticket.ts index 1da56448..6cef462c 100644 --- a/src/api/resources/unstable/resources/tickets/types/Ticket.ts +++ b/src/api/resources/unstable/resources/tickets/types/Ticket.ts @@ -7,33 +7,33 @@ import type * as Intercom from "../../../../../index.js"; */ export interface Ticket { /** Always ticket */ - type?: "ticket"; + type?: "ticket" | undefined; /** The unique identifier for the ticket which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The ID of the Ticket used in the Intercom Inbox and Messenger. Do not use ticket_id for API queries. */ - ticket_id?: string; + ticket_id?: string | undefined; /** Category of the Ticket. */ - category?: Ticket.Category; - ticket_attributes?: Intercom.unstable.TicketCustomAttributes; - ticket_state?: Intercom.unstable.TicketState; - ticket_type?: Intercom.unstable.TicketType; - contacts?: Intercom.unstable.TicketContacts; + category?: Ticket.Category | undefined; + ticket_attributes?: Intercom.unstable.TicketCustomAttributes | undefined; + ticket_state?: Intercom.unstable.TicketState | undefined; + ticket_type?: Intercom.unstable.TicketType | undefined; + contacts?: Intercom.unstable.TicketContacts | undefined; /** The id representing the admin assigned to the ticket. */ - admin_assignee_id?: string; + admin_assignee_id?: string | undefined; /** The id representing the team assigned to the ticket. */ - team_assignee_id?: string; + team_assignee_id?: string | undefined; /** The time the ticket was created as a UTC Unix timestamp. */ - created_at?: number; + created_at?: number | undefined; /** The last time the ticket was updated as a UTC Unix timestamp. */ - updated_at?: number; + updated_at?: number | undefined; /** Whether or not the ticket is open. If false, the ticket is closed. */ - open?: boolean; + open?: boolean | undefined; /** The time the ticket will be snoozed until as a UTC Unix timestamp. If null, the ticket is not currently snoozed. */ - snoozed_until?: number; - linked_objects?: Intercom.unstable.LinkedObjectList; - ticket_parts?: Intercom.unstable.TicketParts; + snoozed_until?: number | undefined; + linked_objects?: Intercom.unstable.LinkedObjectList | undefined; + ticket_parts?: Intercom.unstable.TicketParts | undefined; /** Whether or not the ticket is shared with the customer. */ - is_shared?: boolean; + is_shared?: boolean | undefined; } export namespace Ticket { diff --git a/src/api/resources/unstable/resources/tickets/types/TicketContacts.ts b/src/api/resources/unstable/resources/tickets/types/TicketContacts.ts index f85afa9f..1d0d172c 100644 --- a/src/api/resources/unstable/resources/tickets/types/TicketContacts.ts +++ b/src/api/resources/unstable/resources/tickets/types/TicketContacts.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../../../index.js"; */ export interface TicketContacts { /** always contact.list */ - type?: "contact.list"; + type?: "contact.list" | undefined; /** The list of contacts affected by this ticket. */ - contacts?: Intercom.unstable.ContactReference[]; + contacts?: Intercom.unstable.ContactReference[] | undefined; } diff --git a/src/api/resources/unstable/resources/tickets/types/TicketPart.ts b/src/api/resources/unstable/resources/tickets/types/TicketPart.ts index 6ab9ce04..9bbc263a 100644 --- a/src/api/resources/unstable/resources/tickets/types/TicketPart.ts +++ b/src/api/resources/unstable/resources/tickets/types/TicketPart.ts @@ -7,34 +7,34 @@ import type * as Intercom from "../../../../../index.js"; */ export interface TicketPart { /** Always ticket_part */ - type?: string; + type?: string | undefined; /** The id representing the ticket part. */ - id?: string; + id?: string | undefined; /** The type of ticket part. */ - part_type?: string; + part_type?: string | undefined; /** The message body, which may contain HTML. */ - body?: string; + body?: string | undefined; /** The previous state of the ticket. */ - previous_ticket_state?: TicketPart.PreviousTicketState; + previous_ticket_state?: TicketPart.PreviousTicketState | undefined; /** The state of the ticket. */ - ticket_state?: TicketPart.TicketState; + ticket_state?: TicketPart.TicketState | undefined; /** The time the ticket part was created. */ - created_at?: number; + created_at?: number | undefined; /** The last time the ticket part was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.) */ - assigned_to?: Intercom.unstable.Reference; - author?: Intercom.unstable.TicketPartAuthor; + assigned_to?: Intercom.unstable.Reference | undefined; + author?: Intercom.unstable.TicketPartAuthor | undefined; /** A list of attachments for the part. */ - attachments?: Intercom.unstable.PartAttachment[]; + attachments?: Intercom.unstable.PartAttachment[] | undefined; /** The external id of the ticket part */ - external_id?: string; + external_id?: string | undefined; /** Whether or not the ticket part has been redacted. */ - redacted?: boolean; + redacted?: boolean | undefined; /** The app package code if this part was created via API. Note this field won't show if the part was not created via API. */ - app_package_code?: string; + app_package_code?: string | undefined; /** The updated attribute data of the ticket part. Only present for attribute update parts. */ - updated_attribute_data?: TicketPart.UpdatedAttributeData; + updated_attribute_data?: TicketPart.UpdatedAttributeData | undefined; } export namespace TicketPart { diff --git a/src/api/resources/unstable/resources/tickets/types/TicketState.ts b/src/api/resources/unstable/resources/tickets/types/TicketState.ts index beef89c7..ddd717c1 100644 --- a/src/api/resources/unstable/resources/tickets/types/TicketState.ts +++ b/src/api/resources/unstable/resources/tickets/types/TicketState.ts @@ -5,15 +5,15 @@ */ export interface TicketState { /** String representing the object's type. Always has the value `ticket_state`. */ - type?: string; + type?: string | undefined; /** The id of the ticket state */ - id?: string; + id?: string | undefined; /** The category of the ticket state */ - category?: TicketState.Category; + category?: TicketState.Category | undefined; /** The state the ticket is currently in, in a human readable form - visible in Intercom */ - internal_label?: string; + internal_label?: string | undefined; /** The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. */ - external_label?: string; + external_label?: string | undefined; } export namespace TicketState { diff --git a/src/api/resources/unstable/resources/tickets/types/TicketStateDetailed.ts b/src/api/resources/unstable/resources/tickets/types/TicketStateDetailed.ts index 1281034c..70777a69 100644 --- a/src/api/resources/unstable/resources/tickets/types/TicketStateDetailed.ts +++ b/src/api/resources/unstable/resources/tickets/types/TicketStateDetailed.ts @@ -7,19 +7,19 @@ import type * as Intercom from "../../../../../index.js"; */ export interface TicketStateDetailed { /** String representing the object's type. Always has the value `ticket_state`. */ - type?: string; + type?: string | undefined; /** The id of the ticket state */ - id?: string; + id?: string | undefined; /** The category of the ticket state */ - category?: TicketStateDetailed.Category; + category?: TicketStateDetailed.Category | undefined; /** The state the ticket is currently in, in a human readable form - visible in Intercom */ - internal_label?: string; + internal_label?: string | undefined; /** The state the ticket is currently in, in a human readable form - visible to customers, in the messenger, email and tickets portal. */ - external_label?: string; + external_label?: string | undefined; /** Whether the ticket state is archived */ - archived?: boolean; + archived?: boolean | undefined; /** A list of ticket types associated with a given ticket state. */ - ticket_types?: TicketStateDetailed.TicketTypes; + ticket_types?: TicketStateDetailed.TicketTypes | undefined; } export namespace TicketStateDetailed { @@ -37,8 +37,8 @@ export namespace TicketStateDetailed { */ export interface TicketTypes { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of ticket type attributes associated with a given ticket type. */ - data?: (Intercom.unstable.TicketType | undefined)[]; + data?: (Intercom.unstable.TicketType | undefined)[] | undefined; } } diff --git a/src/api/resources/unstable/resources/tickets/types/TicketType.ts b/src/api/resources/unstable/resources/tickets/types/TicketType.ts index bdb7bae4..1069981f 100644 --- a/src/api/resources/unstable/resources/tickets/types/TicketType.ts +++ b/src/api/resources/unstable/resources/tickets/types/TicketType.ts @@ -7,28 +7,28 @@ import type * as Intercom from "../../../../../index.js"; */ export interface TicketType { /** String representing the object's type. Always has the value `ticket_type`. */ - type?: string; + type?: string | undefined; /** The id representing the ticket type. */ - id?: string; + id?: string | undefined; /** Category of the Ticket Type. */ - category?: TicketType.Category; + category?: TicketType.Category | undefined; /** The name of the ticket type */ - name?: string; + name?: string | undefined; /** The description of the ticket type */ - description?: string; + description?: string | undefined; /** The icon of the ticket type */ - icon?: string; + icon?: string | undefined; /** The id of the workspace that the ticket type belongs to. */ - workspace_id?: string; - ticket_type_attributes?: Intercom.unstable.TicketTypeAttributeList; + workspace_id?: string | undefined; + ticket_type_attributes?: Intercom.unstable.TicketTypeAttributeList | undefined; /** A list of ticket states associated with a given ticket type. */ - ticket_states?: TicketType.TicketStates; + ticket_states?: TicketType.TicketStates | undefined; /** Whether the ticket type is archived or not. */ - archived?: boolean; + archived?: boolean | undefined; /** The date and time the ticket type was created. */ - created_at?: number; + created_at?: number | undefined; /** The date and time the ticket type was last updated. */ - updated_at?: number; + updated_at?: number | undefined; } export namespace TicketType { @@ -45,8 +45,8 @@ export namespace TicketType { */ export interface TicketStates { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of ticket states associated with a given ticket type. */ - data?: (Intercom.unstable.TicketState | undefined)[]; + data?: (Intercom.unstable.TicketState | undefined)[] | undefined; } } diff --git a/src/api/resources/unstable/resources/visitors/client/Client.ts b/src/api/resources/unstable/resources/visitors/client/Client.ts index 600ffecf..e7cc84ff 100644 --- a/src/api/resources/unstable/resources/visitors/client/Client.ts +++ b/src/api/resources/unstable/resources/visitors/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../Ba import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../../../core/headers.js"; import * as core from "../../../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../../../core/requestBody.js"; import * as environments from "../../../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace VisitorsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +34,8 @@ export class VisitorsClient { * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.visitors.retrieveVisitorWithUserId({ @@ -51,8 +54,9 @@ export class VisitorsClient { requestOptions?: VisitorsClient.RequestOptions, ): Promise> { const { user_id: userId } = request; - const _queryParams: Record = {}; - _queryParams.user_id = userId; + const _queryParams: Record = { + user_id: userId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -69,7 +73,11 @@ export class VisitorsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -111,11 +119,13 @@ export class VisitorsClient { * * **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body. * - * @param {Intercom.UpdateVisitorRequestOne} request + * @param {Intercom.unstable.UpdateVisitorRequest} request * @param {VisitorsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.visitors.updateVisitor({ @@ -130,14 +140,14 @@ export class VisitorsClient { * }) */ public updateVisitor( - request?: Intercom.UpdateVisitorRequestOne, + request: Intercom.unstable.UpdateVisitorRequest, requestOptions?: VisitorsClient.RequestOptions, ): core.HttpResponsePromise { return core.HttpResponsePromise.fromPromise(this.__updateVisitor(request, requestOptions)); } private async __updateVisitor( - request?: Intercom.UpdateVisitorRequestOne, + request: Intercom.unstable.UpdateVisitorRequest, requestOptions?: VisitorsClient.RequestOptions, ): Promise> { const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); @@ -157,9 +167,9 @@ export class VisitorsClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -205,6 +215,8 @@ export class VisitorsClient { * @param {VisitorsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.unstable.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.visitors.convertVisitor({ @@ -245,9 +257,9 @@ export class VisitorsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/visitors/client/requests/ConvertVisitorRequest.ts b/src/api/resources/unstable/resources/visitors/client/requests/ConvertVisitorRequest.ts index 0dceb82c..72854a32 100644 --- a/src/api/resources/unstable/resources/visitors/client/requests/ConvertVisitorRequest.ts +++ b/src/api/resources/unstable/resources/visitors/client/requests/ConvertVisitorRequest.ts @@ -15,6 +15,19 @@ export interface ConvertVisitorRequest { /** Represents the role of the Contact model. Accepts `lead` or `user`. */ type: string; - user?: unknown; - visitor?: unknown; + /** The unique identifiers retained after converting or merging. */ + user: ConvertVisitorRequest.User; + /** The unique identifiers to convert a single Visitor. */ + visitor: ConvertVisitorRequest.Visitor; +} + +export namespace ConvertVisitorRequest { + /** + * The unique identifiers retained after converting or merging. + */ + export type User = unknown; + /** + * The unique identifiers to convert a single Visitor. + */ + export type Visitor = unknown; } diff --git a/src/api/resources/unstable/resources/visitors/exports.ts b/src/api/resources/unstable/resources/visitors/exports.ts new file mode 100644 index 00000000..5b7d947a --- /dev/null +++ b/src/api/resources/unstable/resources/visitors/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { VisitorsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/resources/workflows/client/Client.ts b/src/api/resources/unstable/resources/workflows/client/Client.ts index 9e14a53a..ebe1b554 100644 --- a/src/api/resources/unstable/resources/workflows/client/Client.ts +++ b/src/api/resources/unstable/resources/workflows/client/Client.ts @@ -10,7 +10,7 @@ import * as errors from "../../../../../../errors/index.js"; import * as Intercom from "../../../../../index.js"; export declare namespace WorkflowsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -39,6 +39,8 @@ export class WorkflowsClient { * * @throws {@link Intercom.unstable.ForbiddenError} * @throws {@link Intercom.unstable.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.unstable.workflows.exportWorkflow({ @@ -69,11 +71,11 @@ export class WorkflowsClient { (await core.Supplier.get(this._options.baseUrl)) ?? (await core.Supplier.get(this._options.environment)) ?? environments.IntercomEnvironment.UsProduction, - `export/workflows/${core.url.encodePathParam(id)}`, + `export/workflows/${core.url.encodePathParam(id, errors.IntercomError)}`, ), method: "GET", headers: _headers, - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/unstable/resources/workflows/exports.ts b/src/api/resources/unstable/resources/workflows/exports.ts new file mode 100644 index 00000000..88bcc813 --- /dev/null +++ b/src/api/resources/unstable/resources/workflows/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { WorkflowsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/resources/unstable/types/ActivityLog.ts b/src/api/resources/unstable/types/ActivityLog.ts index e510cac9..212bf0b5 100644 --- a/src/api/resources/unstable/types/ActivityLog.ts +++ b/src/api/resources/unstable/types/ActivityLog.ts @@ -7,15 +7,15 @@ import type * as Intercom from "../../../index.js"; */ export interface ActivityLog { /** The id representing the activity. */ - id?: string; + id?: string | undefined; /** Details about the Admin involved in the activity. */ - performed_by?: ActivityLog.PerformedBy; - metadata?: Intercom.unstable.ActivityLogMetadata; + performed_by?: ActivityLog.PerformedBy | undefined; + metadata?: Intercom.unstable.ActivityLogMetadata | undefined; /** The time the activity was created. */ - created_at?: number; - activity_type?: ActivityLog.ActivityType; + created_at?: number | undefined; + activity_type?: ActivityLog.ActivityType | undefined; /** A sentence or two describing the activity. */ - activity_description?: string; + activity_description?: string | undefined; } export namespace ActivityLog { @@ -24,13 +24,13 @@ export namespace ActivityLog { */ export interface PerformedBy { /** String representing the object's type. Always has the value `admin`. */ - type?: string; + type?: string | undefined; /** The id representing the admin. */ - id?: string; + id?: string | undefined; /** The email of the admin. */ - email?: string; + email?: string | undefined; /** The IP address of the admin. */ - ip?: string; + ip?: string | undefined; } export const ActivityType = { diff --git a/src/api/resources/unstable/types/ActivityLogList.ts b/src/api/resources/unstable/types/ActivityLogList.ts index f570390b..06c5b2f9 100644 --- a/src/api/resources/unstable/types/ActivityLogList.ts +++ b/src/api/resources/unstable/types/ActivityLogList.ts @@ -7,8 +7,8 @@ import type * as Intercom from "../../../index.js"; */ export interface ActivityLogList { /** String representing the object's type. Always has the value `activity_log.list`. */ - type?: string; - pages?: Intercom.unstable.CursorPages; + type?: string | undefined; + pages?: Intercom.unstable.CursorPages | undefined; /** An array of activity logs */ - activity_logs?: (Intercom.unstable.ActivityLog | undefined)[]; + activity_logs?: (Intercom.unstable.ActivityLog | undefined)[] | undefined; } diff --git a/src/api/resources/unstable/types/ActivityLogMetadata.ts b/src/api/resources/unstable/types/ActivityLogMetadata.ts index cbd7324e..34607bdb 100644 --- a/src/api/resources/unstable/types/ActivityLogMetadata.ts +++ b/src/api/resources/unstable/types/ActivityLogMetadata.ts @@ -5,25 +5,25 @@ */ export interface ActivityLogMetadata { /** The way the admin signed in. */ - sign_in_method?: string; + sign_in_method?: string | undefined; /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; + external_id?: string | undefined; /** The away mode status which is set to true when away and false when returned. */ - away_mode?: boolean; + away_mode?: boolean | undefined; /** The reason the Admin is away. */ - away_status_reason?: string; + away_status_reason?: string | undefined; /** Indicates if conversations should be reassigned while an Admin is away. */ - reassign_conversations?: boolean; + reassign_conversations?: boolean | undefined; /** The action that initiated the status change. */ - source?: string; + source?: string | undefined; /** Indicates if the status was changed automatically or manually. */ - auto_changed?: string; + auto_changed?: string | undefined; /** The ID of the Admin who initiated the activity. */ - update_by?: number; + update_by?: number | undefined; /** The name of the Admin who initiated the activity. */ - update_by_name?: string; + update_by_name?: string | undefined; /** The conversation assignment limit value for an admin. */ - conversation_assignment_limit?: number; + conversation_assignment_limit?: number | undefined; /** The ticket assignment limit value for an admin. */ - ticket_assignment_limit?: number; + ticket_assignment_limit?: number | undefined; } diff --git a/src/api/resources/unstable/types/AddressableList.ts b/src/api/resources/unstable/types/AddressableList.ts index cbda5a63..baced083 100644 --- a/src/api/resources/unstable/types/AddressableList.ts +++ b/src/api/resources/unstable/types/AddressableList.ts @@ -5,9 +5,9 @@ */ export interface AddressableList { /** The addressable object type */ - type?: string; + type?: string | undefined; /** The id of the addressable object */ - id?: string; + id?: string | undefined; /** Url to get more company resources for this contact */ - url?: string; + url?: string | undefined; } diff --git a/src/api/resources/unstable/types/AdminList.ts b/src/api/resources/unstable/types/AdminList.ts index 01507d8d..5954a633 100644 --- a/src/api/resources/unstable/types/AdminList.ts +++ b/src/api/resources/unstable/types/AdminList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface AdminList { /** String representing the object's type. Always has the value `admin.list`. */ - type?: string; + type?: string | undefined; /** A list of admins associated with a given workspace. */ - admins?: (Intercom.unstable.Admin | undefined)[]; + admins?: (Intercom.unstable.Admin | undefined)[] | undefined; } diff --git a/src/api/resources/unstable/types/AdminPriorityLevel.ts b/src/api/resources/unstable/types/AdminPriorityLevel.ts index 1127dadf..f325b503 100644 --- a/src/api/resources/unstable/types/AdminPriorityLevel.ts +++ b/src/api/resources/unstable/types/AdminPriorityLevel.ts @@ -5,7 +5,7 @@ */ export interface AdminPriorityLevel { /** The primary admin ids for the team */ - primary_admin_ids?: number[]; + primary_admin_ids?: number[] | undefined; /** The secondary admin ids for the team */ - secondary_admin_ids?: number[]; + secondary_admin_ids?: number[] | undefined; } diff --git a/src/api/resources/unstable/types/AdminReplyConversationRequest.ts b/src/api/resources/unstable/types/AdminReplyConversationRequest.ts index cf90c85b..5e7241b8 100644 --- a/src/api/resources/unstable/types/AdminReplyConversationRequest.ts +++ b/src/api/resources/unstable/types/AdminReplyConversationRequest.ts @@ -9,17 +9,17 @@ export interface AdminReplyConversationRequest { message_type: AdminReplyConversationRequest.MessageType; type: "admin"; /** The text body of the reply. Notes accept some HTML formatting. Must be present for comment and note message types. */ - body?: string; + body?: string | undefined; /** The id of the admin who is authoring the comment. */ admin_id: string; /** The time the reply was created. If not provided, the current time will be used. */ - created_at?: number; + created_at?: number | undefined; /** The quick reply options to display to the end user. Must be present for quick_reply message types. */ - reply_options?: Intercom.unstable.QuickReplyOption[]; + reply_options?: Intercom.unstable.QuickReplyOption[] | undefined; /** A list of image URLs that will be added as attachments. You can include up to 10 URLs. */ - attachment_urls?: string[]; + attachment_urls?: string[] | undefined; /** A list of files that will be added as attachments. You can include up to 10 files */ - attachment_files?: Intercom.unstable.ConversationAttachmentFiles[]; + attachment_files?: Intercom.unstable.ConversationAttachmentFiles[] | undefined; } export namespace AdminReplyConversationRequest { diff --git a/src/api/resources/unstable/types/AdminReplyTicketRequest.ts b/src/api/resources/unstable/types/AdminReplyTicketRequest.ts index 3e2ac1ed..9f570c75 100644 --- a/src/api/resources/unstable/types/AdminReplyTicketRequest.ts +++ b/src/api/resources/unstable/types/AdminReplyTicketRequest.ts @@ -7,15 +7,15 @@ export interface AdminReplyTicketRequest { message_type: AdminReplyTicketRequest.MessageType; type: "admin"; /** The text body of the reply. Notes accept some HTML formatting. Must be present for comment and note message types. */ - body?: string; + body?: string | undefined; /** The id of the admin who is authoring the comment. */ admin_id: string; /** The time the reply was created. If not provided, the current time will be used. */ - created_at?: number; + created_at?: number | undefined; /** The quick reply options to display. Must be present for quick_reply message types. */ - reply_options?: AdminReplyTicketRequest.ReplyOptions.Item[]; + reply_options?: AdminReplyTicketRequest.ReplyOptions.Item[] | undefined; /** A list of image URLs that will be added as attachments. You can include up to 10 URLs. */ - attachment_urls?: string[]; + attachment_urls?: string[] | undefined; } export namespace AdminReplyTicketRequest { diff --git a/src/api/resources/unstable/types/AdminWithApp.ts b/src/api/resources/unstable/types/AdminWithApp.ts index 37c0c32c..2a56a21f 100644 --- a/src/api/resources/unstable/types/AdminWithApp.ts +++ b/src/api/resources/unstable/types/AdminWithApp.ts @@ -7,29 +7,29 @@ import type * as Intercom from "../../../index.js"; */ export interface AdminWithApp { /** String representing the object's type. Always has the value `admin`. */ - type?: string; + type?: string | undefined; /** The id representing the admin. */ - id?: string; + id?: string | undefined; /** The name of the admin. */ - name?: string; + name?: string | undefined; /** The email of the admin. */ - email?: string; + email?: string | undefined; /** The job title of the admin. */ - job_title?: string; + job_title?: string | undefined; /** Identifies if this admin is currently set in away mode. */ - away_mode_enabled?: boolean; + away_mode_enabled?: boolean | undefined; /** Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. */ - away_mode_reassign?: boolean; + away_mode_reassign?: boolean | undefined; /** Identifies if this admin has a paid inbox seat to restrict/allow features that require them. */ - has_inbox_seat?: boolean; + has_inbox_seat?: boolean | undefined; /** This is a list of ids of the teams that this admin is part of. */ - team_ids?: number[]; + team_ids?: number[] | undefined; /** This object represents the avatar associated with the admin. */ - avatar?: AdminWithApp.Avatar; + avatar?: AdminWithApp.Avatar | undefined; /** Identifies if this admin's email is verified. */ - email_verified?: boolean; + email_verified?: boolean | undefined; /** App that the admin belongs to. */ - app?: Intercom.unstable.App; + app?: Intercom.unstable.App | undefined; } export namespace AdminWithApp { @@ -38,8 +38,8 @@ export namespace AdminWithApp { */ export interface Avatar { /** This is a string that identifies the type of the object. It will always have the value `avatar`. */ - type?: string; + type?: string | undefined; /** This object represents the avatar associated with the admin. */ - image_url?: string; + image_url?: string | undefined; } } diff --git a/src/api/resources/unstable/types/AiCallResponse.ts b/src/api/resources/unstable/types/AiCallResponse.ts index 6f90c177..23543568 100644 --- a/src/api/resources/unstable/types/AiCallResponse.ts +++ b/src/api/resources/unstable/types/AiCallResponse.ts @@ -5,23 +5,23 @@ */ export interface AiCallResponse { /** The unique identifier for the external reference */ - id?: number; + id?: number | undefined; /** The workspace identifier */ - app_id?: number; + app_id?: number | undefined; /** Phone number in E.164 format for the call */ - user_phone_number?: string; + user_phone_number?: string | undefined; /** Status of the call. Can be "registered", "in-progress", or a resolution state */ - status?: string; + status?: string | undefined; /** The Intercom call identifier, if the call has been matched */ - intercom_call_id?: string; + intercom_call_id?: string | undefined; /** The external call identifier from the call provider */ - external_call_id?: string; + external_call_id?: string | undefined; /** The Intercom conversation identifier, if a conversation has been created */ - intercom_conversation_id?: string; + intercom_conversation_id?: string | undefined; /** Array of transcript entries for the call */ - call_transcript?: Record[]; + call_transcript?: Record[] | undefined; /** Summary of the call conversation, truncated to 256 characters. Empty string if no summary available. */ - call_summary?: string; + call_summary?: string | undefined; /** Array of intent classifications for the call */ - intent?: Record[]; + intent?: Record[] | undefined; } diff --git a/src/api/resources/unstable/types/App.ts b/src/api/resources/unstable/types/App.ts index 67ce2d3c..092e2d52 100644 --- a/src/api/resources/unstable/types/App.ts +++ b/src/api/resources/unstable/types/App.ts @@ -4,18 +4,17 @@ * App is a workspace on Intercom */ export interface App { - /** */ - type?: string; + type?: string | undefined; /** The id of the app. */ - id_code?: string; + id_code?: string | undefined; /** The name of the app. */ - name?: string; + name?: string | undefined; /** The Intercom region the app is located in. */ - region?: string; + region?: string | undefined; /** The timezone of the region where the app is located. */ - timezone?: string; + timezone?: string | undefined; /** When the app was created. */ - created_at?: number; + created_at?: number | undefined; /** Whether or not the app uses identity verification. */ - identity_verification?: boolean; + identity_verification?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ArticleContent.ts b/src/api/resources/unstable/types/ArticleContent.ts index bccb5af5..fc728a41 100644 --- a/src/api/resources/unstable/types/ArticleContent.ts +++ b/src/api/resources/unstable/types/ArticleContent.ts @@ -5,23 +5,23 @@ */ export interface ArticleContent { /** The type of object - `article_content` . */ - type?: "article_content"; + type?: "article_content" | undefined; /** The title of the article. */ - title?: string; + title?: string | undefined; /** The description of the article. */ - description?: string; + description?: string | undefined; /** The body of the article. */ - body?: string; + body?: string | undefined; /** The ID of the author of the article. */ - author_id?: number; + author_id?: number | undefined; /** Whether the article is `published` or is a `draft` . */ - state?: ArticleContent.State; + state?: ArticleContent.State | undefined; /** The time when the article was created (seconds). */ - created_at?: number; + created_at?: number | undefined; /** The time when the article was last updated (seconds). */ - updated_at?: number; + updated_at?: number | undefined; /** The URL of the article. */ - url?: string; + url?: string | undefined; } export namespace ArticleContent { diff --git a/src/api/resources/unstable/types/ArticleList.ts b/src/api/resources/unstable/types/ArticleList.ts index 67d409ef..827ab6ed 100644 --- a/src/api/resources/unstable/types/ArticleList.ts +++ b/src/api/resources/unstable/types/ArticleList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface ArticleList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.unstable.CursorPages; + type?: "list" | undefined; + pages?: Intercom.unstable.CursorPages | undefined; /** A count of the total number of articles. */ - total_count?: number; + total_count?: number | undefined; /** An array of Article objects */ - data?: Intercom.unstable.ArticleListItem[]; + data?: Intercom.unstable.ArticleListItem[] | undefined; } diff --git a/src/api/resources/unstable/types/ArticleStatistics.ts b/src/api/resources/unstable/types/ArticleStatistics.ts index 16f14f48..9388b466 100644 --- a/src/api/resources/unstable/types/ArticleStatistics.ts +++ b/src/api/resources/unstable/types/ArticleStatistics.ts @@ -5,17 +5,17 @@ */ export interface ArticleStatistics { /** The type of object - `article_statistics`. */ - type?: "article_statistics"; + type?: "article_statistics" | undefined; /** The number of total views the article has received. */ - views?: number; + views?: number | undefined; /** The number of conversations started from the article. */ - conversions?: number; + conversions?: number | undefined; /** The number of total reactions the article has received. */ - reactions?: number; + reactions?: number | undefined; /** The percentage of happy reactions the article has received against other types of reaction. */ - happy_reaction_percentage?: number; + happy_reaction_percentage?: number | undefined; /** The percentage of neutral reactions the article has received against other types of reaction. */ - neutral_reaction_percentage?: number; + neutral_reaction_percentage?: number | undefined; /** The percentage of sad reactions the article has received against other types of reaction. */ - sad_reaction_percentage?: number; + sad_reaction_percentage?: number | undefined; } diff --git a/src/api/resources/unstable/types/ArticleTranslatedContent.ts b/src/api/resources/unstable/types/ArticleTranslatedContent.ts index 2e625936..8cd67ada 100644 --- a/src/api/resources/unstable/types/ArticleTranslatedContent.ts +++ b/src/api/resources/unstable/types/ArticleTranslatedContent.ts @@ -7,79 +7,79 @@ import type * as Intercom from "../../../index.js"; */ export interface ArticleTranslatedContent { /** The type of object - article_translated_content. */ - type?: "article_translated_content"; + type?: "article_translated_content" | undefined; /** The content of the article in Arabic */ - ar?: Intercom.unstable.ArticleContent; + ar?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Bulgarian */ - bg?: Intercom.unstable.ArticleContent; + bg?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Bosnian */ - bs?: Intercom.unstable.ArticleContent; + bs?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Catalan */ - ca?: Intercom.unstable.ArticleContent; + ca?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Czech */ - cs?: Intercom.unstable.ArticleContent; + cs?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Danish */ - da?: Intercom.unstable.ArticleContent; + da?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in German */ - de?: Intercom.unstable.ArticleContent; + de?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Greek */ - el?: Intercom.unstable.ArticleContent; + el?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in English */ - en?: Intercom.unstable.ArticleContent; + en?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Spanish */ - es?: Intercom.unstable.ArticleContent; + es?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Estonian */ - et?: Intercom.unstable.ArticleContent; + et?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Finnish */ - fi?: Intercom.unstable.ArticleContent; + fi?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in French */ - fr?: Intercom.unstable.ArticleContent; + fr?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Hebrew */ - he?: Intercom.unstable.ArticleContent; + he?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Croatian */ - hr?: Intercom.unstable.ArticleContent; + hr?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Hungarian */ - hu?: Intercom.unstable.ArticleContent; + hu?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Indonesian */ - id?: Intercom.unstable.ArticleContent; + id?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Italian */ - it?: Intercom.unstable.ArticleContent; + it?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Japanese */ - ja?: Intercom.unstable.ArticleContent; + ja?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Korean */ - ko?: Intercom.unstable.ArticleContent; + ko?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Lithuanian */ - lt?: Intercom.unstable.ArticleContent; + lt?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Latvian */ - lv?: Intercom.unstable.ArticleContent; + lv?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Mongolian */ - mn?: Intercom.unstable.ArticleContent; + mn?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Norwegian */ - nb?: Intercom.unstable.ArticleContent; + nb?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Dutch */ - nl?: Intercom.unstable.ArticleContent; + nl?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Polish */ - pl?: Intercom.unstable.ArticleContent; + pl?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Portuguese (Portugal) */ - pt?: Intercom.unstable.ArticleContent; + pt?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Romanian */ - ro?: Intercom.unstable.ArticleContent; + ro?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Russian */ - ru?: Intercom.unstable.ArticleContent; + ru?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Slovenian */ - sl?: Intercom.unstable.ArticleContent; + sl?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Serbian */ - sr?: Intercom.unstable.ArticleContent; + sr?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Swedish */ - sv?: Intercom.unstable.ArticleContent; + sv?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Turkish */ - tr?: Intercom.unstable.ArticleContent; + tr?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Vietnamese */ - vi?: Intercom.unstable.ArticleContent; + vi?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Portuguese (Brazil) */ - "pt-BR"?: Intercom.unstable.ArticleContent; + "pt-BR"?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Chinese (China) */ - "zh-CN"?: Intercom.unstable.ArticleContent; + "zh-CN"?: Intercom.unstable.ArticleContent | undefined; /** The content of the article in Chinese (Taiwan) */ - "zh-TW"?: Intercom.unstable.ArticleContent; + "zh-TW"?: Intercom.unstable.ArticleContent | undefined; } diff --git a/src/api/resources/unstable/types/AssignConversationRequest.ts b/src/api/resources/unstable/types/AssignConversationRequest.ts index 0e2e8ba8..f41ad1dd 100644 --- a/src/api/resources/unstable/types/AssignConversationRequest.ts +++ b/src/api/resources/unstable/types/AssignConversationRequest.ts @@ -10,7 +10,7 @@ export interface AssignConversationRequest { /** The `id` of the `admin` or `team` which will be assigned the conversation. A conversation can be assigned both an admin and a team.\nSet `0` if you want this assign to no admin or team (ie. Unassigned). */ assignee_id: string; /** Optionally you can send a response in the conversation when it is assigned. */ - body?: string; + body?: string | undefined; } export namespace AssignConversationRequest { diff --git a/src/api/resources/unstable/types/AwayStatusReason.ts b/src/api/resources/unstable/types/AwayStatusReason.ts index 01eaf720..4faa7455 100644 --- a/src/api/resources/unstable/types/AwayStatusReason.ts +++ b/src/api/resources/unstable/types/AwayStatusReason.ts @@ -1,19 +1,19 @@ // This file was auto-generated by Fern from our API Definition. export interface AwayStatusReason { - type?: string; + type?: string | undefined; /** The unique identifier for the away status reason */ - id?: string; + id?: string | undefined; /** The display text for the away status reason */ - label?: string; + label?: string | undefined; /** The emoji associated with the status reason */ - emoji?: string; + emoji?: string | undefined; /** The display order of the status reason */ - order?: number; + order?: number | undefined; /** Whether the status reason has been soft deleted */ - deleted?: boolean; + deleted?: boolean | undefined; /** The Unix timestamp when the status reason was created */ - created_at?: number; + created_at?: number | undefined; /** The Unix timestamp when the status reason was last updated */ - updated_at?: number; + updated_at?: number | undefined; } diff --git a/src/api/resources/unstable/types/CallList.ts b/src/api/resources/unstable/types/CallList.ts index bd332337..de226c49 100644 --- a/src/api/resources/unstable/types/CallList.ts +++ b/src/api/resources/unstable/types/CallList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface CallList { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of calls. */ - data?: Intercom.unstable.Call[]; + data?: Intercom.unstable.Call[] | undefined; /** Total number of items available. */ - total_count?: number; - pages?: Intercom.unstable.CursorPages; + total_count?: number | undefined; + pages?: Intercom.unstable.CursorPages | undefined; } diff --git a/src/api/resources/unstable/types/CloseConversationRequest.ts b/src/api/resources/unstable/types/CloseConversationRequest.ts index 0c75f0c3..6330b51e 100644 --- a/src/api/resources/unstable/types/CloseConversationRequest.ts +++ b/src/api/resources/unstable/types/CloseConversationRequest.ts @@ -8,5 +8,5 @@ export interface CloseConversationRequest { /** The id of the admin who is performing the action. */ admin_id: string; /** Optionally you can leave a message in the conversation to provide additional context to the user and other teammates. */ - body?: string; + body?: string | undefined; } diff --git a/src/api/resources/unstable/types/CollectionList.ts b/src/api/resources/unstable/types/CollectionList.ts index 455ae28a..535813b8 100644 --- a/src/api/resources/unstable/types/CollectionList.ts +++ b/src/api/resources/unstable/types/CollectionList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface CollectionList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.unstable.CursorPages; + type?: "list" | undefined; + pages?: Intercom.unstable.CursorPages | undefined; /** A count of the total number of collections. */ - total_count?: number; + total_count?: number | undefined; /** An array of collection objects */ - data?: Intercom.unstable.Collection[]; + data?: Intercom.unstable.Collection[] | undefined; } diff --git a/src/api/resources/unstable/types/CompanyAttachedContacts.ts b/src/api/resources/unstable/types/CompanyAttachedContacts.ts index d23643b4..61a0b7c7 100644 --- a/src/api/resources/unstable/types/CompanyAttachedContacts.ts +++ b/src/api/resources/unstable/types/CompanyAttachedContacts.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface CompanyAttachedContacts { /** The type of object - `list` */ - type?: "list"; + type?: "list" | undefined; /** An array containing Contact Objects */ - data?: Intercom.unstable.Contact[]; + data?: Intercom.unstable.Contact[] | undefined; /** The total number of contacts */ - total_count?: number; - pages?: Intercom.unstable.CursorPages; + total_count?: number | undefined; + pages?: Intercom.unstable.CursorPages | undefined; } diff --git a/src/api/resources/unstable/types/CompanyAttachedSegments.ts b/src/api/resources/unstable/types/CompanyAttachedSegments.ts index 73ace745..5bc54f0a 100644 --- a/src/api/resources/unstable/types/CompanyAttachedSegments.ts +++ b/src/api/resources/unstable/types/CompanyAttachedSegments.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface CompanyAttachedSegments { /** The type of object - `list` */ - type?: "list"; + type?: "list" | undefined; /** An array containing Segment Objects */ - data?: Intercom.unstable.Segment[]; + data?: Intercom.unstable.Segment[] | undefined; } diff --git a/src/api/resources/unstable/types/CompanyData.ts b/src/api/resources/unstable/types/CompanyData.ts index 29d3a559..1a645a28 100644 --- a/src/api/resources/unstable/types/CompanyData.ts +++ b/src/api/resources/unstable/types/CompanyData.ts @@ -5,9 +5,9 @@ */ export interface CompanyData { /** The unique identifier for the company which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The type of the object. Always company. */ - type?: "company"; + type?: "company" | undefined; /** The relative URL of the company. */ - url?: string; + url?: string | undefined; } diff --git a/src/api/resources/unstable/types/CompanyList.ts b/src/api/resources/unstable/types/CompanyList.ts index 670df0a5..e3ceb1c0 100644 --- a/src/api/resources/unstable/types/CompanyList.ts +++ b/src/api/resources/unstable/types/CompanyList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface CompanyList { /** The type of object - `list`. */ - type?: "list"; - pages?: Intercom.unstable.CursorPages; + type?: "list" | undefined; + pages?: Intercom.unstable.CursorPages | undefined; /** The total number of companies. */ - total_count?: number; + total_count?: number | undefined; /** An array containing Company Objects. */ - data?: Intercom.unstable.Company[]; + data?: Intercom.unstable.Company[] | undefined; } diff --git a/src/api/resources/unstable/types/CompanyScroll.ts b/src/api/resources/unstable/types/CompanyScroll.ts index 4f876c99..e88ba3f4 100644 --- a/src/api/resources/unstable/types/CompanyScroll.ts +++ b/src/api/resources/unstable/types/CompanyScroll.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../../../index.js"; */ export interface CompanyScroll { /** The type of object - `list` */ - type?: "list"; - data?: Intercom.unstable.Company[]; - pages?: Intercom.unstable.CursorPages; + type?: "list" | undefined; + data?: Intercom.unstable.Company[] | undefined; + pages?: Intercom.unstable.CursorPages | undefined; /** The total number of companies */ - total_count?: number; + total_count?: number | undefined; /** The scroll parameter to use in the next request to fetch the next page of results. */ - scroll_param?: string; + scroll_param?: string | undefined; } diff --git a/src/api/resources/unstable/types/ContactArchived.ts b/src/api/resources/unstable/types/ContactArchived.ts index b99dc919..8c879181 100644 --- a/src/api/resources/unstable/types/ContactArchived.ts +++ b/src/api/resources/unstable/types/ContactArchived.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactArchived extends Intercom.unstable.ContactReference { /** Whether the contact is archived or not. */ - archived?: boolean; + archived?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ContactAttachedCompanies.ts b/src/api/resources/unstable/types/ContactAttachedCompanies.ts index c9afae62..b9490760 100644 --- a/src/api/resources/unstable/types/ContactAttachedCompanies.ts +++ b/src/api/resources/unstable/types/ContactAttachedCompanies.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactAttachedCompanies { /** The type of object */ - type?: "list"; + type?: "list" | undefined; /** An array containing Company Objects */ - companies?: Intercom.unstable.Company[]; + companies?: Intercom.unstable.Company[] | undefined; /** The total number of companies associated to this contact */ - total_count?: number; - pages?: Intercom.unstable.PagesLink; + total_count?: number | undefined; + pages?: Intercom.unstable.PagesLink | undefined; } diff --git a/src/api/resources/unstable/types/ContactBlocked.ts b/src/api/resources/unstable/types/ContactBlocked.ts index 0d31658f..9773e0b6 100644 --- a/src/api/resources/unstable/types/ContactBlocked.ts +++ b/src/api/resources/unstable/types/ContactBlocked.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactBlocked extends Intercom.unstable.ContactReference { /** Always true. */ - blocked?: boolean; + blocked?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ContactCompanies.ts b/src/api/resources/unstable/types/ContactCompanies.ts index c78c8889..7ca2f7dd 100644 --- a/src/api/resources/unstable/types/ContactCompanies.ts +++ b/src/api/resources/unstable/types/ContactCompanies.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactCompanies { /** An array of company data objects attached to the contact. */ - data?: Intercom.unstable.CompanyData[]; + data?: Intercom.unstable.CompanyData[] | undefined; /** Url to get more company resources for this contact */ - url?: string; + url?: string | undefined; /** Integer representing the total number of companies attached to this contact */ - total_count?: number; + total_count?: number | undefined; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more?: boolean; + has_more?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ContactDeleted.ts b/src/api/resources/unstable/types/ContactDeleted.ts index c5a47283..6ec5dc6a 100644 --- a/src/api/resources/unstable/types/ContactDeleted.ts +++ b/src/api/resources/unstable/types/ContactDeleted.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactDeleted extends Intercom.unstable.ContactReference { /** Whether the contact is deleted or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ContactList.ts b/src/api/resources/unstable/types/ContactList.ts index 5ef1b342..d46a338c 100644 --- a/src/api/resources/unstable/types/ContactList.ts +++ b/src/api/resources/unstable/types/ContactList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactList { /** Always list */ - type?: "list"; + type?: "list" | undefined; /** The list of contact objects */ - data?: Intercom.unstable.Contact[]; + data?: Intercom.unstable.Contact[] | undefined; /** A count of the total number of objects. */ - total_count?: number; - pages?: Intercom.unstable.CursorPages; + total_count?: number | undefined; + pages?: Intercom.unstable.CursorPages | undefined; } diff --git a/src/api/resources/unstable/types/ContactLocation.ts b/src/api/resources/unstable/types/ContactLocation.ts index 73f32530..77c241fd 100644 --- a/src/api/resources/unstable/types/ContactLocation.ts +++ b/src/api/resources/unstable/types/ContactLocation.ts @@ -5,11 +5,11 @@ */ export interface ContactLocation { /** Always location */ - type?: string; + type?: string | undefined; /** The country that the contact is located in */ - country?: string; + country?: string | undefined; /** The overal region that the contact is located in */ - region?: string; + region?: string | undefined; /** The city that the contact is located in */ - city?: string; + city?: string | undefined; } diff --git a/src/api/resources/unstable/types/ContactNotes.ts b/src/api/resources/unstable/types/ContactNotes.ts index 88338f22..75f6c048 100644 --- a/src/api/resources/unstable/types/ContactNotes.ts +++ b/src/api/resources/unstable/types/ContactNotes.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactNotes { /** This object represents the notes attached to a contact. */ - data?: Intercom.unstable.AddressableList[]; + data?: Intercom.unstable.AddressableList[] | undefined; /** Url to get more company resources for this contact */ - url?: string; + url?: string | undefined; /** Int representing the total number of companyies attached to this contact */ - total_count?: number; + total_count?: number | undefined; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more?: boolean; + has_more?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ContactReference.ts b/src/api/resources/unstable/types/ContactReference.ts index 6ff6080e..8ce949a7 100644 --- a/src/api/resources/unstable/types/ContactReference.ts +++ b/src/api/resources/unstable/types/ContactReference.ts @@ -5,9 +5,9 @@ */ export interface ContactReference { /** always contact */ - type?: "contact"; + type?: "contact" | undefined; /** The unique identifier for the contact which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; + external_id?: string | undefined; } diff --git a/src/api/resources/unstable/types/ContactReplyBaseRequest.ts b/src/api/resources/unstable/types/ContactReplyBaseRequest.ts index e6ebd102..cb7c6c49 100644 --- a/src/api/resources/unstable/types/ContactReplyBaseRequest.ts +++ b/src/api/resources/unstable/types/ContactReplyBaseRequest.ts @@ -6,11 +6,11 @@ export interface ContactReplyBaseRequest { /** The text body of the comment. */ body: string; /** The time the reply was created. If not provided, the current time will be used. */ - created_at?: number; + created_at?: number | undefined; /** A list of image URLs that will be added as attachments. You can include up to 10 URLs. */ - attachment_urls?: string[]; + attachment_urls?: string[] | undefined; /** The quick reply selection the contact wishes to respond with. These map to buttons displayed in the Messenger UI if sent by a bot, or the reply options sent by an Admin via the API. */ - reply_options?: ContactReplyBaseRequest.ReplyOptions.Item[]; + reply_options?: ContactReplyBaseRequest.ReplyOptions.Item[] | undefined; } export namespace ContactReplyBaseRequest { diff --git a/src/api/resources/unstable/types/ContactReplyEmailRequest.ts b/src/api/resources/unstable/types/ContactReplyEmailRequest.ts index 31f73734..fdd36524 100644 --- a/src/api/resources/unstable/types/ContactReplyEmailRequest.ts +++ b/src/api/resources/unstable/types/ContactReplyEmailRequest.ts @@ -9,5 +9,5 @@ export interface ContactReplyEmailRequest extends Intercom.unstable.ContactReply /** The email you have defined for the user. */ email: string; /** A list of files that will be added as attachments. */ - attachment_files?: Intercom.unstable.ConversationAttachmentFiles[]; + attachment_files?: Intercom.unstable.ConversationAttachmentFiles[] | undefined; } diff --git a/src/api/resources/unstable/types/ContactReplyIntercomUserIdRequest.ts b/src/api/resources/unstable/types/ContactReplyIntercomUserIdRequest.ts index edd5a8fd..ff4d1428 100644 --- a/src/api/resources/unstable/types/ContactReplyIntercomUserIdRequest.ts +++ b/src/api/resources/unstable/types/ContactReplyIntercomUserIdRequest.ts @@ -9,5 +9,5 @@ export interface ContactReplyIntercomUserIdRequest extends Intercom.unstable.Con /** The identifier for the contact as given by Intercom. */ intercom_user_id: string; /** A list of files that will be added as attachments. */ - attachment_files?: Intercom.unstable.ConversationAttachmentFiles[]; + attachment_files?: Intercom.unstable.ConversationAttachmentFiles[] | undefined; } diff --git a/src/api/resources/unstable/types/ContactReplyUserIdRequest.ts b/src/api/resources/unstable/types/ContactReplyUserIdRequest.ts index 6870f212..b3fd74e1 100644 --- a/src/api/resources/unstable/types/ContactReplyUserIdRequest.ts +++ b/src/api/resources/unstable/types/ContactReplyUserIdRequest.ts @@ -9,5 +9,5 @@ export interface ContactReplyUserIdRequest extends Intercom.unstable.ContactRepl /** The external_id you have defined for the contact. */ user_id: string; /** A list of files that will be added as attachments. You can include up to 10 files. */ - attachment_files?: Intercom.unstable.ConversationAttachmentFiles[]; + attachment_files?: Intercom.unstable.ConversationAttachmentFiles[] | undefined; } diff --git a/src/api/resources/unstable/types/ContactSegments.ts b/src/api/resources/unstable/types/ContactSegments.ts index 370cfde9..87cd2140 100644 --- a/src/api/resources/unstable/types/ContactSegments.ts +++ b/src/api/resources/unstable/types/ContactSegments.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactSegments { /** The type of the object */ - type?: "list"; + type?: "list" | undefined; /** Segment objects associated with the contact. */ - data?: Intercom.unstable.Segment[]; + data?: Intercom.unstable.Segment[] | undefined; } diff --git a/src/api/resources/unstable/types/ContactSocialProfiles.ts b/src/api/resources/unstable/types/ContactSocialProfiles.ts index dd46662b..58951200 100644 --- a/src/api/resources/unstable/types/ContactSocialProfiles.ts +++ b/src/api/resources/unstable/types/ContactSocialProfiles.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactSocialProfiles { /** A list of social profiles objects associated with the contact. */ - data?: Intercom.unstable.SocialProfile[]; + data?: Intercom.unstable.SocialProfile[] | undefined; } diff --git a/src/api/resources/unstable/types/ContactSubscriptionTypes.ts b/src/api/resources/unstable/types/ContactSubscriptionTypes.ts index b478bc44..cc4ad0eb 100644 --- a/src/api/resources/unstable/types/ContactSubscriptionTypes.ts +++ b/src/api/resources/unstable/types/ContactSubscriptionTypes.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactSubscriptionTypes { /** This object represents the subscriptions attached to a contact. */ - data?: Intercom.unstable.AddressableList[]; + data?: Intercom.unstable.AddressableList[] | undefined; /** Url to get more subscription type resources for this contact */ - url?: string; + url?: string | undefined; /** Int representing the total number of subscription types attached to this contact */ - total_count?: number; + total_count?: number | undefined; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more?: boolean; + has_more?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ContactTags.ts b/src/api/resources/unstable/types/ContactTags.ts index 2ed6d4e7..5c34dfae 100644 --- a/src/api/resources/unstable/types/ContactTags.ts +++ b/src/api/resources/unstable/types/ContactTags.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactTags { /** This object represents the tags attached to a contact. */ - data?: Intercom.unstable.AddressableList[]; + data?: Intercom.unstable.AddressableList[] | undefined; /** url to get more tag resources for this contact */ - url?: string; + url?: string | undefined; /** Int representing the total number of tags attached to this contact */ - total_count?: number; + total_count?: number | undefined; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more?: boolean; + has_more?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ContactUnarchived.ts b/src/api/resources/unstable/types/ContactUnarchived.ts index e5b151a1..d79b503a 100644 --- a/src/api/resources/unstable/types/ContactUnarchived.ts +++ b/src/api/resources/unstable/types/ContactUnarchived.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../../../index.js"; */ export interface ContactUnarchived extends Intercom.unstable.ContactReference { /** Whether the contact is archived or not. */ - archived?: boolean; + archived?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ContentSourcesList.ts b/src/api/resources/unstable/types/ContentSourcesList.ts index aee5ab31..1ecbb38f 100644 --- a/src/api/resources/unstable/types/ContentSourcesList.ts +++ b/src/api/resources/unstable/types/ContentSourcesList.ts @@ -3,9 +3,9 @@ import type * as Intercom from "../../../index.js"; export interface ContentSourcesList { - type?: "content_source.list"; + type?: "content_source.list" | undefined; /** The total number of content sources used by AI Agent in the conversation. */ - total_count?: number; + total_count?: number | undefined; /** The content sources used by AI Agent in the conversation. */ - content_sources?: Intercom.unstable.ContentSource[]; + content_sources?: Intercom.unstable.ContentSource[] | undefined; } diff --git a/src/api/resources/unstable/types/ConversationAttachmentFiles.ts b/src/api/resources/unstable/types/ConversationAttachmentFiles.ts index f1a0b3e5..db43e27a 100644 --- a/src/api/resources/unstable/types/ConversationAttachmentFiles.ts +++ b/src/api/resources/unstable/types/ConversationAttachmentFiles.ts @@ -5,9 +5,9 @@ */ export interface ConversationAttachmentFiles { /** The content type of the file */ - content_type?: string; + content_type?: string | undefined; /** The base64 encoded file data. */ - data?: string; + data?: string | undefined; /** The name of the file. */ - name?: string; + name?: string | undefined; } diff --git a/src/api/resources/unstable/types/ConversationAttributeUpdatedByAdmin.ts b/src/api/resources/unstable/types/ConversationAttributeUpdatedByAdmin.ts index 997b2ea3..bedd6388 100644 --- a/src/api/resources/unstable/types/ConversationAttributeUpdatedByAdmin.ts +++ b/src/api/resources/unstable/types/ConversationAttributeUpdatedByAdmin.ts @@ -4,20 +4,20 @@ * Contains details about Custom Data Attributes (CDAs) that were modified by an admin (operator) for conversation part type conversation_attribute_updated_by_admin. */ export interface ConversationAttributeUpdatedByAdmin { - attribute?: ConversationAttributeUpdatedByAdmin.Attribute; - value?: ConversationAttributeUpdatedByAdmin.Value; + attribute?: ConversationAttributeUpdatedByAdmin.Attribute | undefined; + value?: ConversationAttributeUpdatedByAdmin.Value | undefined; } export namespace ConversationAttributeUpdatedByAdmin { export interface Attribute { /** Name of the CDA updated */ - name?: string; + name?: string | undefined; } export interface Value { /** Current value of the CDA updated */ - name?: string; + name?: string | undefined; /** Previous value of the CDA */ - previous?: string; + previous?: string | undefined; } } diff --git a/src/api/resources/unstable/types/ConversationAttributeUpdatedByUser.ts b/src/api/resources/unstable/types/ConversationAttributeUpdatedByUser.ts index c0f19e67..80e38ae8 100644 --- a/src/api/resources/unstable/types/ConversationAttributeUpdatedByUser.ts +++ b/src/api/resources/unstable/types/ConversationAttributeUpdatedByUser.ts @@ -4,20 +4,20 @@ * Contains details about Custom Data Attributes (CDAs) that were modified by a user for conversation part type conversation_attribute_updated_by_user. */ export interface ConversationAttributeUpdatedByUser { - attribute?: ConversationAttributeUpdatedByUser.Attribute; - value?: ConversationAttributeUpdatedByUser.Value; + attribute?: ConversationAttributeUpdatedByUser.Attribute | undefined; + value?: ConversationAttributeUpdatedByUser.Value | undefined; } export namespace ConversationAttributeUpdatedByUser { export interface Attribute { /** Name of the CDA updated */ - name?: string; + name?: string | undefined; } export interface Value { /** Current value of the CDA updated */ - name?: string; + name?: string | undefined; /** Previous value of the CDA (null for older events) */ - previous?: string; + previous?: string | undefined; } } diff --git a/src/api/resources/unstable/types/ConversationAttributeUpdatedByWorkflow.ts b/src/api/resources/unstable/types/ConversationAttributeUpdatedByWorkflow.ts index e9e75f32..99bf143a 100644 --- a/src/api/resources/unstable/types/ConversationAttributeUpdatedByWorkflow.ts +++ b/src/api/resources/unstable/types/ConversationAttributeUpdatedByWorkflow.ts @@ -4,24 +4,24 @@ * Contains details about the workflow that was triggered and any Custom Data Attributes (CDAs) that were modified during the workflow execution for conversation part type conversation_attribute_updated_by_workflow. */ export interface ConversationAttributeUpdatedByWorkflow { - workflow?: ConversationAttributeUpdatedByWorkflow.Workflow; - attribute?: ConversationAttributeUpdatedByWorkflow.Attribute; - value?: ConversationAttributeUpdatedByWorkflow.Value; + workflow?: ConversationAttributeUpdatedByWorkflow.Workflow | undefined; + attribute?: ConversationAttributeUpdatedByWorkflow.Attribute | undefined; + value?: ConversationAttributeUpdatedByWorkflow.Value | undefined; } export namespace ConversationAttributeUpdatedByWorkflow { export interface Workflow { /** Name of the workflow */ - name?: string; + name?: string | undefined; } export interface Attribute { /** Name of the CDA updated */ - name?: string; + name?: string | undefined; } export interface Value { /** Value of the CDA updated */ - name?: string; + name?: string | undefined; } } diff --git a/src/api/resources/unstable/types/ConversationContacts.ts b/src/api/resources/unstable/types/ConversationContacts.ts index eb49d28f..f549142a 100644 --- a/src/api/resources/unstable/types/ConversationContacts.ts +++ b/src/api/resources/unstable/types/ConversationContacts.ts @@ -6,8 +6,7 @@ import type * as Intercom from "../../../index.js"; * The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature. */ export interface ConversationContacts { - /** */ - type?: "contact.list"; + type?: "contact.list" | undefined; /** The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature. */ - contacts?: Intercom.unstable.ContactReference[]; + contacts?: Intercom.unstable.ContactReference[] | undefined; } diff --git a/src/api/resources/unstable/types/ConversationDeleted.ts b/src/api/resources/unstable/types/ConversationDeleted.ts index e61823b9..fb49ade5 100644 --- a/src/api/resources/unstable/types/ConversationDeleted.ts +++ b/src/api/resources/unstable/types/ConversationDeleted.ts @@ -5,9 +5,9 @@ */ export interface ConversationDeleted { /** The unique identifier for the conversation. */ - id?: string; + id?: string | undefined; /** always conversation */ - object?: "conversation"; + object?: "conversation" | undefined; /** Whether the conversation is deleted or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ConversationFirstContactReply.ts b/src/api/resources/unstable/types/ConversationFirstContactReply.ts index 2085bd1e..f0610a31 100644 --- a/src/api/resources/unstable/types/ConversationFirstContactReply.ts +++ b/src/api/resources/unstable/types/ConversationFirstContactReply.ts @@ -4,10 +4,7 @@ * An object containing information on the first users message. For a contact initiated message this will represent the users original message. */ export interface ConversationFirstContactReply { - /** */ - created_at?: number; - /** */ - type?: string; - /** */ - url?: string; + created_at?: number | undefined; + type?: string | undefined; + url?: string | undefined; } diff --git a/src/api/resources/unstable/types/ConversationList.ts b/src/api/resources/unstable/types/ConversationList.ts index 9a0a768e..38aa2637 100644 --- a/src/api/resources/unstable/types/ConversationList.ts +++ b/src/api/resources/unstable/types/ConversationList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface ConversationList { /** Always conversation.list */ - type?: "conversation.list"; + type?: "conversation.list" | undefined; /** The list of conversation objects */ - conversations?: Intercom.unstable.Conversation[]; + conversations?: Intercom.unstable.Conversation[] | undefined; /** A count of the total number of objects. */ - total_count?: number; - pages?: Intercom.unstable.CursorPages; + total_count?: number | undefined; + pages?: Intercom.unstable.CursorPages | undefined; } diff --git a/src/api/resources/unstable/types/ConversationPart.ts b/src/api/resources/unstable/types/ConversationPart.ts index 0d55a965..0eecc00e 100644 --- a/src/api/resources/unstable/types/ConversationPart.ts +++ b/src/api/resources/unstable/types/ConversationPart.ts @@ -7,37 +7,37 @@ import type * as Intercom from "../../../index.js"; */ export interface ConversationPart { /** Always conversation_part */ - type?: string; + type?: string | undefined; /** The id representing the conversation part. */ - id?: string; + id?: string | undefined; /** The type of conversation part. */ - part_type?: string; + part_type?: string | undefined; /** The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured. */ - body?: string; + body?: string | undefined; /** The time the conversation part was created. */ - created_at?: number; + created_at?: number | undefined; /** The last time the conversation part was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The time the user was notified with the conversation part. */ - notified_at?: number; + notified_at?: number | undefined; /** The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.) */ - assigned_to?: Intercom.unstable.Reference; - author?: Intercom.unstable.ConversationPartAuthor; + assigned_to?: Intercom.unstable.Reference | undefined; + author?: Intercom.unstable.ConversationPartAuthor | undefined; /** A list of attachments for the part. */ - attachments?: Intercom.unstable.PartAttachment[]; + attachments?: Intercom.unstable.PartAttachment[] | undefined; /** The external id of the conversation part */ - external_id?: string; + external_id?: string | undefined; /** Whether or not the conversation part has been redacted. */ - redacted?: boolean; - email_message_metadata?: Intercom.unstable.EmailMessageMetadata; - metadata?: Intercom.unstable.ConversationPartMetadata; + redacted?: boolean | undefined; + email_message_metadata?: Intercom.unstable.EmailMessageMetadata | undefined; + metadata?: Intercom.unstable.ConversationPartMetadata | undefined; /** Indicates the current state of conversation when the conversation part was created. */ - state?: ConversationPart.State; + state?: ConversationPart.State | undefined; /** A list of tags objects associated with the conversation part. */ - tags?: Intercom.unstable.TagBasic[]; - event_details?: Intercom.unstable.EventDetails; + tags?: Intercom.unstable.TagBasic[] | undefined; + event_details?: Intercom.unstable.EventDetails | undefined; /** The app package code if this part was created via API. null if the part was not created via API. */ - app_package_code?: string; + app_package_code?: string | undefined; } export namespace ConversationPart { diff --git a/src/api/resources/unstable/types/ConversationPartAuthor.ts b/src/api/resources/unstable/types/ConversationPartAuthor.ts index 3a17d751..9d3a01eb 100644 --- a/src/api/resources/unstable/types/ConversationPartAuthor.ts +++ b/src/api/resources/unstable/types/ConversationPartAuthor.ts @@ -5,15 +5,15 @@ */ export interface ConversationPartAuthor { /** The type of the author */ - type?: string; + type?: string | undefined; /** The id of the author */ - id?: string; + id?: string | undefined; /** The name of the author */ - name?: string; + name?: string | undefined; /** The email of the author */ - email?: string; + email?: string | undefined; /** If this conversation part was sent by the AI Agent */ - from_ai_agent?: boolean; + from_ai_agent?: boolean | undefined; /** If this conversation part body was generated by the AI Agent */ - is_ai_answer?: boolean; + is_ai_answer?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/ConversationPartMetadata.ts b/src/api/resources/unstable/types/ConversationPartMetadata.ts index 73de6365..01cfb3b4 100644 --- a/src/api/resources/unstable/types/ConversationPartMetadata.ts +++ b/src/api/resources/unstable/types/ConversationPartMetadata.ts @@ -7,9 +7,9 @@ import type * as Intercom from "../../../index.js"; */ export interface ConversationPartMetadata { /** The quick reply options sent by the Admin or bot, presented in this conversation part. */ - quick_reply_options?: ConversationPartMetadata.QuickReplyOptions.Item[]; + quick_reply_options?: ConversationPartMetadata.QuickReplyOptions.Item[] | undefined; /** The unique identifier for the quick reply option that was clicked by the end user. */ - quick_reply_uuid?: string; + quick_reply_uuid?: string | undefined; } export namespace ConversationPartMetadata { @@ -18,7 +18,7 @@ export namespace ConversationPartMetadata { export namespace QuickReplyOptions { export interface Item extends Intercom.unstable.QuickReplyOption { /** The translations for the quick reply option. */ - translations?: Record; + translations?: Record | undefined; } } } diff --git a/src/api/resources/unstable/types/ConversationParts.ts b/src/api/resources/unstable/types/ConversationParts.ts index a1e3f943..7b43ab3e 100644 --- a/src/api/resources/unstable/types/ConversationParts.ts +++ b/src/api/resources/unstable/types/ConversationParts.ts @@ -6,10 +6,8 @@ import type * as Intercom from "../../../index.js"; * A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts. */ export interface ConversationParts { - /** */ - type?: "conversation_part.list"; + type?: "conversation_part.list" | undefined; /** A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts. */ - conversation_parts?: Intercom.unstable.ConversationPart[]; - /** */ - total_count?: number; + conversation_parts?: Intercom.unstable.ConversationPart[] | undefined; + total_count?: number | undefined; } diff --git a/src/api/resources/unstable/types/ConversationRating.ts b/src/api/resources/unstable/types/ConversationRating.ts index 1edf63c5..0743310f 100644 --- a/src/api/resources/unstable/types/ConversationRating.ts +++ b/src/api/resources/unstable/types/ConversationRating.ts @@ -7,13 +7,13 @@ import type * as Intercom from "../../../index.js"; */ export interface ConversationRating { /** The rating, between 1 and 5, for the conversation. */ - rating?: number; + rating?: number | undefined; /** An optional field to add a remark to correspond to the number rating */ - remark?: string; + remark?: string | undefined; /** The time the rating was requested in the conversation being rated. */ - created_at?: number; + created_at?: number | undefined; /** The time the rating was last updated. */ - updated_at?: number; - contact?: Intercom.unstable.ContactReference; - teammate?: Intercom.unstable.Reference; + updated_at?: number | undefined; + contact?: Intercom.unstable.ContactReference | undefined; + teammate?: Intercom.unstable.Reference | undefined; } diff --git a/src/api/resources/unstable/types/ConversationResponseTime.ts b/src/api/resources/unstable/types/ConversationResponseTime.ts index 8c503679..3cd82fbb 100644 --- a/src/api/resources/unstable/types/ConversationResponseTime.ts +++ b/src/api/resources/unstable/types/ConversationResponseTime.ts @@ -5,9 +5,9 @@ */ export interface ConversationResponseTime { /** Id of the assigned team. */ - team_id?: number; + team_id?: number | undefined; /** Name of the assigned Team, null if team does not exist, Unassigned if no team is assigned. */ - team_name?: string; + team_name?: string | undefined; /** First response time of assigned team in seconds. */ - response_time?: number; + response_time?: number | undefined; } diff --git a/src/api/resources/unstable/types/ConversationSlaAppliedByRule.ts b/src/api/resources/unstable/types/ConversationSlaAppliedByRule.ts index 8340e44f..3e807f86 100644 --- a/src/api/resources/unstable/types/ConversationSlaAppliedByRule.ts +++ b/src/api/resources/unstable/types/ConversationSlaAppliedByRule.ts @@ -5,9 +5,9 @@ */ export interface ConversationSlaAppliedByRule { /** Name of the SLA that was applied */ - sla_name?: string; + sla_name?: string | undefined; /** Target times configured for the SLA (in seconds) */ - sla_definition?: ConversationSlaAppliedByRule.SlaDefinition; + sla_definition?: ConversationSlaAppliedByRule.SlaDefinition | undefined; } export namespace ConversationSlaAppliedByRule { @@ -16,12 +16,12 @@ export namespace ConversationSlaAppliedByRule { */ export interface SlaDefinition { /** First response time target in seconds */ - first_reply_time?: number; + first_reply_time?: number | undefined; /** Next reply time target in seconds */ - next_reply_time?: number; + next_reply_time?: number | undefined; /** Resolution time target in seconds */ - resolution_time?: number; + resolution_time?: number | undefined; /** Time to close target in seconds */ - time_to_close?: number; + time_to_close?: number | undefined; } } diff --git a/src/api/resources/unstable/types/ConversationSlaAppliedByWorkflow.ts b/src/api/resources/unstable/types/ConversationSlaAppliedByWorkflow.ts index 29b5464d..178e574e 100644 --- a/src/api/resources/unstable/types/ConversationSlaAppliedByWorkflow.ts +++ b/src/api/resources/unstable/types/ConversationSlaAppliedByWorkflow.ts @@ -5,9 +5,9 @@ */ export interface ConversationSlaAppliedByWorkflow { /** Name of the SLA that was applied */ - sla_name?: string; + sla_name?: string | undefined; /** Target times configured for the SLA (in seconds) */ - sla_definition?: ConversationSlaAppliedByWorkflow.SlaDefinition; + sla_definition?: ConversationSlaAppliedByWorkflow.SlaDefinition | undefined; } export namespace ConversationSlaAppliedByWorkflow { @@ -16,12 +16,12 @@ export namespace ConversationSlaAppliedByWorkflow { */ export interface SlaDefinition { /** First response time target in seconds */ - first_reply_time?: number; + first_reply_time?: number | undefined; /** Next reply time target in seconds */ - next_reply_time?: number; + next_reply_time?: number | undefined; /** Resolution time target in seconds */ - resolution_time?: number; + resolution_time?: number | undefined; /** Time to close target in seconds */ - time_to_close?: number; + time_to_close?: number | undefined; } } diff --git a/src/api/resources/unstable/types/ConversationSlaPaused.ts b/src/api/resources/unstable/types/ConversationSlaPaused.ts index eb842828..0aa5a2a1 100644 --- a/src/api/resources/unstable/types/ConversationSlaPaused.ts +++ b/src/api/resources/unstable/types/ConversationSlaPaused.ts @@ -5,11 +5,11 @@ */ export interface ConversationSlaPaused { /** Name of the SLA being paused */ - sla_name?: string; + sla_name?: string | undefined; /** Overall SLA status at pause time */ - current_sla_status?: ConversationSlaPaused.CurrentSlaStatus; + current_sla_status?: ConversationSlaPaused.CurrentSlaStatus | undefined; /** Status of all SLA targets at pause time */ - sla_states?: Record; + sla_states?: Record | undefined; } export namespace ConversationSlaPaused { @@ -25,9 +25,9 @@ export namespace ConversationSlaPaused { export namespace SlaStates { export interface Value { /** Status of this specific target (always paused) */ - status?: "paused"; + status?: "paused" | undefined; /** Time remaining when paused */ - seconds_remaining?: number; + seconds_remaining?: number | undefined; } } } diff --git a/src/api/resources/unstable/types/ConversationSlaRemoved.ts b/src/api/resources/unstable/types/ConversationSlaRemoved.ts index c0007356..21dc3e04 100644 --- a/src/api/resources/unstable/types/ConversationSlaRemoved.ts +++ b/src/api/resources/unstable/types/ConversationSlaRemoved.ts @@ -5,5 +5,5 @@ */ export interface ConversationSlaRemoved { /** Name of the SLA that was removed */ - sla_name?: string; + sla_name?: string | undefined; } diff --git a/src/api/resources/unstable/types/ConversationSlaTargetMissed.ts b/src/api/resources/unstable/types/ConversationSlaTargetMissed.ts index bec5f996..f9b1aa66 100644 --- a/src/api/resources/unstable/types/ConversationSlaTargetMissed.ts +++ b/src/api/resources/unstable/types/ConversationSlaTargetMissed.ts @@ -5,13 +5,13 @@ */ export interface ConversationSlaTargetMissed { /** Name of the SLA */ - sla_name?: string; + sla_name?: string | undefined; /** Which specific target was missed */ - sla_target_type?: ConversationSlaTargetMissed.SlaTargetType; + sla_target_type?: ConversationSlaTargetMissed.SlaTargetType | undefined; /** Overall SLA status */ - current_sla_status?: ConversationSlaTargetMissed.CurrentSlaStatus; + current_sla_status?: ConversationSlaTargetMissed.CurrentSlaStatus | undefined; /** Status of all SLA targets at the time of breach */ - sla_states?: Record; + sla_states?: Record | undefined; } export namespace ConversationSlaTargetMissed { @@ -36,9 +36,9 @@ export namespace ConversationSlaTargetMissed { export namespace SlaStates { export interface Value { /** Status of this specific target */ - status?: Value.Status; + status?: Value.Status | undefined; /** Time remaining for active/paused targets (null for hit/missed) */ - seconds_remaining?: number; + seconds_remaining?: number | undefined; } export namespace Value { diff --git a/src/api/resources/unstable/types/ConversationSlaUnpaused.ts b/src/api/resources/unstable/types/ConversationSlaUnpaused.ts index e7045d0f..6324c770 100644 --- a/src/api/resources/unstable/types/ConversationSlaUnpaused.ts +++ b/src/api/resources/unstable/types/ConversationSlaUnpaused.ts @@ -5,5 +5,5 @@ */ export interface ConversationSlaUnpaused { /** Name of the SLA being unpaused */ - sla_name?: string; + sla_name?: string | undefined; } diff --git a/src/api/resources/unstable/types/ConversationSource.ts b/src/api/resources/unstable/types/ConversationSource.ts index 3987bf3f..05b2e29c 100644 --- a/src/api/resources/unstable/types/ConversationSource.ts +++ b/src/api/resources/unstable/types/ConversationSource.ts @@ -7,22 +7,22 @@ import type * as Intercom from "../../../index.js"; */ export interface ConversationSource { /** This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp. */ - type?: ConversationSource.Type; + type?: ConversationSource.Type | undefined; /** The id representing the message. */ - id?: string; + id?: string | undefined; /** The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email). */ - delivered_as?: string; + delivered_as?: string | undefined; /** Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured. */ - subject?: string; + subject?: string | undefined; /** The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured. */ - body?: string; - author?: Intercom.unstable.ConversationPartAuthor; + body?: string | undefined; + author?: Intercom.unstable.ConversationPartAuthor | undefined; /** A list of attachments for the part. */ - attachments?: Intercom.unstable.PartAttachment[]; + attachments?: Intercom.unstable.PartAttachment[] | undefined; /** The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank. */ - url?: string; + url?: string | undefined; /** Whether or not the source message has been redacted. Only applicable for contact initiated messages. */ - redacted?: boolean; + redacted?: boolean | undefined; } export namespace ConversationSource { diff --git a/src/api/resources/unstable/types/ConversationStatistics.ts b/src/api/resources/unstable/types/ConversationStatistics.ts index 8491c58f..69925382 100644 --- a/src/api/resources/unstable/types/ConversationStatistics.ts +++ b/src/api/resources/unstable/types/ConversationStatistics.ts @@ -6,50 +6,49 @@ import type * as Intercom from "../../../index.js"; * A Statistics object containing all information required for reporting, with timestamps and calculated metrics. */ export interface ConversationStatistics { - /** */ - type?: string; + type?: string | undefined; /** Duration until last assignment before first admin reply. In seconds. */ - time_to_assignment?: number; + time_to_assignment?: number | undefined; /** Duration until first admin reply. Subtracts out of business hours. In seconds. */ - time_to_admin_reply?: number; + time_to_admin_reply?: number | undefined; /** Duration until conversation was closed first time. Subtracts out of business hours. In seconds. */ - time_to_first_close?: number; + time_to_first_close?: number | undefined; /** Duration until conversation was closed last time. Subtracts out of business hours. In seconds. */ - time_to_last_close?: number; + time_to_last_close?: number | undefined; /** Median based on all admin replies after a contact reply. Subtracts out of business hours. In seconds. */ - median_time_to_reply?: number; + median_time_to_reply?: number | undefined; /** Time of first text conversation part from a contact. */ - first_contact_reply_at?: number; + first_contact_reply_at?: number | undefined; /** Time of first assignment after first_contact_reply_at. */ - first_assignment_at?: number; + first_assignment_at?: number | undefined; /** Time of first admin reply after first_contact_reply_at. */ - first_admin_reply_at?: number; + first_admin_reply_at?: number | undefined; /** Time of first close after first_contact_reply_at. */ - first_close_at?: number; + first_close_at?: number | undefined; /** Time of last assignment after first_contact_reply_at. */ - last_assignment_at?: number; + last_assignment_at?: number | undefined; /** Time of first admin reply since most recent assignment. */ - last_assignment_admin_reply_at?: number; + last_assignment_admin_reply_at?: number | undefined; /** Time of the last conversation part from a contact. */ - last_contact_reply_at?: number; + last_contact_reply_at?: number | undefined; /** Time of the last conversation part from an admin. */ - last_admin_reply_at?: number; + last_admin_reply_at?: number | undefined; /** Time of the last conversation close. */ - last_close_at?: number; + last_close_at?: number | undefined; /** The last admin who closed the conversation. Returns a reference to an Admin object. */ - last_closed_by_id?: string; + last_closed_by_id?: string | undefined; /** Number of reopens after first_contact_reply_at. */ - count_reopens?: number; + count_reopens?: number | undefined; /** Number of assignments after first_contact_reply_at. */ - count_assignments?: number; + count_assignments?: number | undefined; /** Total number of conversation parts. */ - count_conversation_parts?: number; + count_conversation_parts?: number | undefined; /** An array of conversation response time objects */ - assigned_team_first_response_time_by_team?: Intercom.unstable.ConversationResponseTime[]; + assigned_team_first_response_time_by_team?: Intercom.unstable.ConversationResponseTime[] | undefined; /** An array of conversation response time objects within office hours */ - assigned_team_first_response_time_in_office_hours?: Intercom.unstable.ConversationResponseTime[]; + assigned_team_first_response_time_in_office_hours?: Intercom.unstable.ConversationResponseTime[] | undefined; /** Time from conversation assignment to conversation close in seconds. */ - handling_time?: number; + handling_time?: number | undefined; /** Adjusted handling time for conversation in seconds. This is the active handling time excluding idle periods when teammates are not actively working on the conversation. */ - adjusted_handling_time?: number; + adjusted_handling_time?: number | undefined; } diff --git a/src/api/resources/unstable/types/ConversationTagsUpdated.ts b/src/api/resources/unstable/types/ConversationTagsUpdated.ts index 556dd3e0..353c5773 100644 --- a/src/api/resources/unstable/types/ConversationTagsUpdated.ts +++ b/src/api/resources/unstable/types/ConversationTagsUpdated.ts @@ -5,7 +5,7 @@ */ export interface ConversationTagsUpdated { /** Array of tag names that were added */ - tags_added?: string[]; + tags_added?: string[] | undefined; /** Array of tag names that were removed */ - tags_removed?: string[]; + tags_removed?: string[] | undefined; } diff --git a/src/api/resources/unstable/types/ConversationTeammates.ts b/src/api/resources/unstable/types/ConversationTeammates.ts index 3932494d..3c89a70e 100644 --- a/src/api/resources/unstable/types/ConversationTeammates.ts +++ b/src/api/resources/unstable/types/ConversationTeammates.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface ConversationTeammates { /** The type of the object - `admin.list`. */ - type?: string; + type?: string | undefined; /** The list of teammates who participated in the conversation (wrote at least one conversation part). */ - teammates?: Intercom.unstable.Reference[]; + teammates?: Intercom.unstable.Reference[] | undefined; } diff --git a/src/api/resources/unstable/types/CreateArticleRequest.ts b/src/api/resources/unstable/types/CreateArticleRequest.ts index fae9a9e6..87996aef 100644 --- a/src/api/resources/unstable/types/CreateArticleRequest.ts +++ b/src/api/resources/unstable/types/CreateArticleRequest.ts @@ -9,18 +9,18 @@ export interface CreateArticleRequest { /** The title of the article.For multilingual articles, this will be the title of the default language's content. */ title: string; /** The description of the article. For multilingual articles, this will be the description of the default language's content. */ - description?: string; + description?: string | undefined; /** The content of the article. For multilingual articles, this will be the body of the default language's content. */ - body?: string; + body?: string | undefined; /** The id of the author of the article. For multilingual articles, this will be the id of the author of the default language's content. Must be a teammate on the help center's workspace. */ author_id: number; /** Whether the article will be `published` or will be a `draft`. Defaults to draft. For multilingual articles, this will be the state of the default language's content. */ - state?: CreateArticleRequest.State; + state?: CreateArticleRequest.State | undefined; /** The id of the article's parent collection or section. An article without this field stands alone. */ - parent_id?: number; + parent_id?: number | undefined; /** The type of parent, which can either be a `collection` or `section`. */ - parent_type?: string; - translated_content?: Intercom.unstable.ArticleTranslatedContent; + parent_type?: string | undefined; + translated_content?: Intercom.unstable.ArticleTranslatedContent | undefined; } export namespace CreateArticleRequest { diff --git a/src/api/resources/unstable/types/CreateContactRequest.ts b/src/api/resources/unstable/types/CreateContactRequest.ts new file mode 100644 index 00000000..f22219db --- /dev/null +++ b/src/api/resources/unstable/types/CreateContactRequest.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Payload to create a contact + */ +export type CreateContactRequest = unknown; diff --git a/src/api/resources/unstable/types/CreateDataAttributeRequest.ts b/src/api/resources/unstable/types/CreateDataAttributeRequest.ts index e2abd5d2..e57537cd 100644 --- a/src/api/resources/unstable/types/CreateDataAttributeRequest.ts +++ b/src/api/resources/unstable/types/CreateDataAttributeRequest.ts @@ -1,8 +1,5 @@ // This file was auto-generated by Fern from our API Definition. -/** - * - */ export type CreateDataAttributeRequest = | { data_type?: "options" | undefined; diff --git a/src/api/resources/unstable/types/CreateDataEventRequest.ts b/src/api/resources/unstable/types/CreateDataEventRequest.ts new file mode 100644 index 00000000..0facdfa9 --- /dev/null +++ b/src/api/resources/unstable/types/CreateDataEventRequest.ts @@ -0,0 +1,3 @@ +// This file was auto-generated by Fern from our API Definition. + +export type CreateDataEventRequest = unknown; diff --git a/src/api/resources/unstable/types/CreateInternalArticleRequest.ts b/src/api/resources/unstable/types/CreateInternalArticleRequest.ts index f971e918..0c226774 100644 --- a/src/api/resources/unstable/types/CreateInternalArticleRequest.ts +++ b/src/api/resources/unstable/types/CreateInternalArticleRequest.ts @@ -7,7 +7,7 @@ export interface CreateInternalArticleRequest { /** The title of the article. */ title: string; /** The content of the article. */ - body?: string; + body?: string | undefined; /** The id of the author of the article. */ author_id: number; /** The id of the owner of the article. */ diff --git a/src/api/resources/unstable/types/CreateMessageRequest.ts b/src/api/resources/unstable/types/CreateMessageRequest.ts index b9bc1f58..9c059387 100644 --- a/src/api/resources/unstable/types/CreateMessageRequest.ts +++ b/src/api/resources/unstable/types/CreateMessageRequest.ts @@ -3,4 +3,4 @@ /** * You can create a message */ -export type CreateMessageRequest = unknown | undefined; +export type CreateMessageRequest = unknown; diff --git a/src/api/resources/unstable/types/CreateOrUpdateCompanyRequest.ts b/src/api/resources/unstable/types/CreateOrUpdateCompanyRequest.ts index 9a465e5c..6ff65a67 100644 --- a/src/api/resources/unstable/types/CreateOrUpdateCompanyRequest.ts +++ b/src/api/resources/unstable/types/CreateOrUpdateCompanyRequest.ts @@ -5,21 +5,21 @@ */ export interface CreateOrUpdateCompanyRequest { /** The name of the Company */ - name?: string; + name?: string | undefined; /** The company id you have defined for the company. Can't be updated */ - company_id?: string; + company_id?: string | undefined; /** The name of the plan you have associated with the company. */ - plan?: string; + plan?: string | undefined; /** The number of employees in this company. */ - size?: number; + size?: number | undefined; /** The URL for this company's website. Please note that the value specified here is not validated. Accepts any string. */ - website?: string; + website?: string | undefined; /** The industry that this company operates in. */ - industry?: string; + industry?: string | undefined; /** A hash of key/value pairs containing any other data about the company you want Intercom to store. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; /** The time the company was created by you. */ - remote_created_at?: number; + remote_created_at?: number | undefined; /** How much revenue the company generates for your business. Note that this will truncate floats. i.e. it only allow for whole integers, 155.98 will be truncated to 155. Note that this has an upper limit of 2**31-1 or 2147483647.. */ - monthly_spend?: number; + monthly_spend?: number | undefined; } diff --git a/src/api/resources/unstable/types/CreateOrUpdateTagRequest.ts b/src/api/resources/unstable/types/CreateOrUpdateTagRequest.ts index 7dfd1b3f..59201c9c 100644 --- a/src/api/resources/unstable/types/CreateOrUpdateTagRequest.ts +++ b/src/api/resources/unstable/types/CreateOrUpdateTagRequest.ts @@ -7,5 +7,5 @@ export interface CreateOrUpdateTagRequest { /** The name of the tag, which will be created if not found, or the new name for the tag if this is an update request. Names are case insensitive. */ name: string; /** The id of tag to updates. */ - id?: string; + id?: string | undefined; } diff --git a/src/api/resources/unstable/types/CreatePhoneSwitchRequest.ts b/src/api/resources/unstable/types/CreatePhoneSwitchRequest.ts index 825757f8..a4ae3e9d 100644 --- a/src/api/resources/unstable/types/CreatePhoneSwitchRequest.ts +++ b/src/api/resources/unstable/types/CreatePhoneSwitchRequest.ts @@ -8,5 +8,5 @@ import type * as Intercom from "../../../index.js"; export interface CreatePhoneSwitchRequest { /** Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. */ phone: string; - custom_attributes?: Intercom.unstable.CustomAttributes; + custom_attributes?: Intercom.unstable.CustomAttributes | undefined; } diff --git a/src/api/resources/unstable/types/CreateTicketRequestBody.ts b/src/api/resources/unstable/types/CreateTicketRequestBody.ts index 9ec9fb5c..125c1338 100644 --- a/src/api/resources/unstable/types/CreateTicketRequestBody.ts +++ b/src/api/resources/unstable/types/CreateTicketRequestBody.ts @@ -15,12 +15,12 @@ export interface CreateTicketRequestBody { * - conversation | tracker ticket * - customer ticket | tracker ticket */ - conversation_to_link_id?: string; + conversation_to_link_id?: string | undefined; /** The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom */ - company_id?: string; + company_id?: string | undefined; /** The time the ticket was created. If not provided, the current time will be used. */ - created_at?: number; - assignment?: CreateTicketRequestBody.Assignment; + created_at?: number | undefined; + assignment?: CreateTicketRequestBody.Assignment | undefined; } export namespace CreateTicketRequestBody { @@ -41,8 +41,8 @@ export namespace CreateTicketRequestBody { export interface Assignment { /** The ID of the admin to which the ticket is assigned. If not provided, the ticket will be unassigned. */ - admin_assignee_id?: string; + admin_assignee_id?: string | undefined; /** The ID of the team to which the ticket is assigned. If not provided, the ticket will be unassigned. */ - team_assignee_id?: string; + team_assignee_id?: string | undefined; } } diff --git a/src/api/resources/unstable/types/CreateTicketTypeRequest.ts b/src/api/resources/unstable/types/CreateTicketTypeRequest.ts index eebc72da..a73b0682 100644 --- a/src/api/resources/unstable/types/CreateTicketTypeRequest.ts +++ b/src/api/resources/unstable/types/CreateTicketTypeRequest.ts @@ -8,13 +8,13 @@ export interface CreateTicketTypeRequest { /** The name of the ticket type. */ name: string; /** The description of the ticket type. */ - description?: string; + description?: string | undefined; /** Category of the Ticket Type. */ - category?: CreateTicketTypeRequest.Category; + category?: CreateTicketTypeRequest.Category | undefined; /** The icon of the ticket type. */ - icon?: string; + icon?: string | undefined; /** Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. */ - is_internal?: boolean; + is_internal?: boolean | undefined; } export namespace CreateTicketTypeRequest { diff --git a/src/api/resources/unstable/types/CursorPages.ts b/src/api/resources/unstable/types/CursorPages.ts index 28a01ed3..372ef0ae 100644 --- a/src/api/resources/unstable/types/CursorPages.ts +++ b/src/api/resources/unstable/types/CursorPages.ts @@ -8,12 +8,12 @@ import type * as Intercom from "../../../index.js"; */ export interface CursorPages { /** the type of object `pages`. */ - type?: "pages"; + type?: "pages" | undefined; /** The current page */ - page?: number; - next?: Intercom.unstable.StartingAfterPaging; + page?: number | undefined; + next?: Intercom.unstable.StartingAfterPaging | undefined; /** Number of results per page */ - per_page?: number; + per_page?: number | undefined; /** Total number of pages */ - total_pages?: number; + total_pages?: number | undefined; } diff --git a/src/api/resources/unstable/types/CustomActionFinished.ts b/src/api/resources/unstable/types/CustomActionFinished.ts index 54471392..d91b32a3 100644 --- a/src/api/resources/unstable/types/CustomActionFinished.ts +++ b/src/api/resources/unstable/types/CustomActionFinished.ts @@ -4,15 +4,15 @@ * Contains details about final status of the completed action for conversation part type custom_action_finished. */ export interface CustomActionFinished { - action?: CustomActionFinished.Action; + action?: CustomActionFinished.Action | undefined; } export namespace CustomActionFinished { export interface Action { /** Name of the action */ - name?: string; + name?: string | undefined; /** Status of the action */ - result?: Action.Result; + result?: Action.Result | undefined; } export namespace Action { diff --git a/src/api/resources/unstable/types/CustomActionStarted.ts b/src/api/resources/unstable/types/CustomActionStarted.ts index 18114f6c..fe8d34ea 100644 --- a/src/api/resources/unstable/types/CustomActionStarted.ts +++ b/src/api/resources/unstable/types/CustomActionStarted.ts @@ -4,12 +4,12 @@ * Contains details about name of the action that was initiated for conversation part type custom_action_started. */ export interface CustomActionStarted { - action?: CustomActionStarted.Action; + action?: CustomActionStarted.Action | undefined; } export namespace CustomActionStarted { export interface Action { /** Name of the action */ - name?: string; + name?: string | undefined; } } diff --git a/src/api/resources/unstable/types/CustomChannelContact.ts b/src/api/resources/unstable/types/CustomChannelContact.ts index 7d11a83c..04676675 100644 --- a/src/api/resources/unstable/types/CustomChannelContact.ts +++ b/src/api/resources/unstable/types/CustomChannelContact.ts @@ -6,9 +6,9 @@ export interface CustomChannelContact { /** External identifier for the contact. Intercom will take care of the mapping of your external_id with our internal ones so you don't have to worry about it. */ external_id: string; /** Name of the contact. Required for user type. */ - name?: string; + name?: string | undefined; /** Email address of the contact. Required for user type. */ - email?: string; + email?: string | undefined; } export namespace CustomChannelContact { diff --git a/src/api/resources/unstable/types/CustomObjectInstanceDeleted.ts b/src/api/resources/unstable/types/CustomObjectInstanceDeleted.ts index 4c14eba9..6cfa0af3 100644 --- a/src/api/resources/unstable/types/CustomObjectInstanceDeleted.ts +++ b/src/api/resources/unstable/types/CustomObjectInstanceDeleted.ts @@ -5,9 +5,9 @@ */ export interface CustomObjectInstanceDeleted { /** The unique identifier of the Custom Object type that defines the structure of the Custom Object instance. */ - object?: string; + object?: string | undefined; /** The Intercom defined id representing the Custom Object instance. */ - id?: string; + id?: string | undefined; /** Whether the Custom Object instance is deleted or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/CustomObjectInstanceList.ts b/src/api/resources/unstable/types/CustomObjectInstanceList.ts index 98e68588..48d3809d 100644 --- a/src/api/resources/unstable/types/CustomObjectInstanceList.ts +++ b/src/api/resources/unstable/types/CustomObjectInstanceList.ts @@ -6,7 +6,7 @@ import type * as Intercom from "../../../index.js"; * The list of associated custom object instances for a given reference attribute on the parent object. */ export interface CustomObjectInstanceList { - type?: string; + type?: string | undefined; /** The list of associated custom object instances for a given reference attribute on the parent object. */ - instances?: (Intercom.unstable.CustomObjectInstance | undefined)[]; + instances?: (Intercom.unstable.CustomObjectInstance | undefined)[] | undefined; } diff --git a/src/api/resources/unstable/types/DataAttributeList.ts b/src/api/resources/unstable/types/DataAttributeList.ts index f8b6055b..cac8fede 100644 --- a/src/api/resources/unstable/types/DataAttributeList.ts +++ b/src/api/resources/unstable/types/DataAttributeList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface DataAttributeList { /** The type of the object */ - type?: "list"; + type?: "list" | undefined; /** A list of data attributes */ - data?: Intercom.unstable.DataAttribute[]; + data?: Intercom.unstable.DataAttribute[] | undefined; } diff --git a/src/api/resources/unstable/types/DataEventList.ts b/src/api/resources/unstable/types/DataEventList.ts index 1fa73fc8..4ed17658 100644 --- a/src/api/resources/unstable/types/DataEventList.ts +++ b/src/api/resources/unstable/types/DataEventList.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../../../index.js"; */ export interface DataEventList { /** The type of the object */ - type?: "event.list"; + type?: "event.list" | undefined; /** A list of data events */ - events?: Intercom.unstable.DataEvent[]; + events?: Intercom.unstable.DataEvent[] | undefined; /** Pagination */ - pages?: DataEventList.Pages; + pages?: DataEventList.Pages | undefined; } export namespace DataEventList { @@ -19,7 +19,7 @@ export namespace DataEventList { * Pagination */ export interface Pages { - next?: string; - since?: string; + next?: string | undefined; + since?: string | undefined; } } diff --git a/src/api/resources/unstable/types/DataEventSummary.ts b/src/api/resources/unstable/types/DataEventSummary.ts index 0badccff..ebed138a 100644 --- a/src/api/resources/unstable/types/DataEventSummary.ts +++ b/src/api/resources/unstable/types/DataEventSummary.ts @@ -7,13 +7,13 @@ import type * as Intercom from "../../../index.js"; */ export interface DataEventSummary { /** The type of the object */ - type?: "event.summary"; + type?: "event.summary" | undefined; /** The email address of the user */ - email?: string; + email?: string | undefined; /** The Intercom user ID of the user */ - intercom_user_id?: string; + intercom_user_id?: string | undefined; /** The user ID of the user */ - user_id?: string; + user_id?: string | undefined; /** A summary of data events */ - events?: (Intercom.unstable.DataEventSummaryItem | undefined)[]; + events?: (Intercom.unstable.DataEventSummaryItem | undefined)[] | undefined; } diff --git a/src/api/resources/unstable/types/DataEventSummaryItem.ts b/src/api/resources/unstable/types/DataEventSummaryItem.ts index 9f0d9192..3f6b87b4 100644 --- a/src/api/resources/unstable/types/DataEventSummaryItem.ts +++ b/src/api/resources/unstable/types/DataEventSummaryItem.ts @@ -5,13 +5,13 @@ */ export interface DataEventSummaryItem { /** The name of the event */ - name?: string; + name?: string | undefined; /** The first time the event was sent */ - first?: string; + first?: string | undefined; /** The last time the event was sent */ - last?: string; + last?: string | undefined; /** The number of times the event was sent */ - count?: number; + count?: number | undefined; /** The description of the event */ - description?: string; + description?: string | undefined; } diff --git a/src/api/resources/unstable/types/DataExportCsv.ts b/src/api/resources/unstable/types/DataExportCsv.ts index 8c268f7e..181d4ecd 100644 --- a/src/api/resources/unstable/types/DataExportCsv.ts +++ b/src/api/resources/unstable/types/DataExportCsv.ts @@ -5,55 +5,55 @@ */ export interface DataExportCsv { /** The user_id of the user who was sent the message. */ - user_id?: string; + user_id?: string | undefined; /** The external_user_id of the user who was sent the message */ - user_external_id?: string; + user_external_id?: string | undefined; /** The company ID of the user in relation to the message that was sent. Will return -1 if no company is present. */ - company_id?: string; + company_id?: string | undefined; /** The users email who was sent the message. */ - email?: string; + email?: string | undefined; /** The full name of the user receiving the message */ - name?: string; + name?: string | undefined; /** The id of the message. */ - ruleset_id?: string; + ruleset_id?: string | undefined; /** The specific content that was received. In an A/B test each version has its own Content ID. */ - content_id?: string; + content_id?: string | undefined; /** Email, Chat, Post etc. */ - content_type?: string; + content_type?: string | undefined; /** The title of the content you see in your Intercom workspace. */ - content_title?: string; + content_title?: string | undefined; /** As you edit content we record new versions. This ID can help you determine which version of a piece of content that was received. */ - ruleset_version_id?: string; + ruleset_version_id?: string | undefined; /** ID for this receipt. Will be included with any related stats in other files to identify this specific delivery of a message. */ - receipt_id?: string; + receipt_id?: string | undefined; /** Timestamp for when the receipt was recorded. */ - received_at?: number; + received_at?: number | undefined; /** The id of the series that this content is part of. Will return -1 if not part of a series. */ - series_id?: string; + series_id?: string | undefined; /** The title of the series that this content is part of. */ - series_title?: string; + series_title?: string | undefined; /** The id of the series node that this ruleset is associated with. Each block in a series has a corresponding node_id. */ - node_id?: string; + node_id?: string | undefined; /** The first time a user replied to this message if the content was able to receive replies. */ - first_reply?: number; + first_reply?: number | undefined; /** The first time a user completed this message if the content was able to be completed e.g. Tours, Surveys. */ - first_completion?: number; + first_completion?: number | undefined; /** The first time the series this message was a part of was completed by the user. */ - first_series_completion?: number; + first_series_completion?: number | undefined; /** The first time the series this message was a part of was disengaged by the user. */ - first_series_disengagement?: number; + first_series_disengagement?: number | undefined; /** The first time the series this message was a part of was exited by the user. */ - first_series_exit?: number; + first_series_exit?: number | undefined; /** The first time the user met this messages associated goal if one exists. */ - first_goal_success?: number; + first_goal_success?: number | undefined; /** The first time the user opened this message. */ - first_open?: number; + first_open?: number | undefined; /** The first time the series the user clicked on a link within this message. */ - first_click?: number; + first_click?: number | undefined; /** The first time the series the user dismissed this message. */ - first_dismisall?: number; + first_dismisall?: number | undefined; /** The first time the user unsubscribed from this message. */ - first_unsubscribe?: number; + first_unsubscribe?: number | undefined; /** The first time this message hard bounced for this user */ - first_hard_bounce?: number; + first_hard_bounce?: number | undefined; } diff --git a/src/api/resources/unstable/types/DeletedArticleObject.ts b/src/api/resources/unstable/types/DeletedArticleObject.ts index 5667114c..b4fb28a3 100644 --- a/src/api/resources/unstable/types/DeletedArticleObject.ts +++ b/src/api/resources/unstable/types/DeletedArticleObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedArticleObject { /** The unique identifier for the article which you provided in the URL. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted. - article */ - object?: "article"; + object?: "article" | undefined; /** Whether the article was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/DeletedCollectionObject.ts b/src/api/resources/unstable/types/DeletedCollectionObject.ts index 4d03d936..8a34ae0c 100644 --- a/src/api/resources/unstable/types/DeletedCollectionObject.ts +++ b/src/api/resources/unstable/types/DeletedCollectionObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedCollectionObject { /** The unique identifier for the collection which you provided in the URL. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted. - `collection` */ - object?: "collection"; + object?: "collection" | undefined; /** Whether the collection was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/DeletedCompanyObject.ts b/src/api/resources/unstable/types/DeletedCompanyObject.ts index b5ee6cf6..9cb69bff 100644 --- a/src/api/resources/unstable/types/DeletedCompanyObject.ts +++ b/src/api/resources/unstable/types/DeletedCompanyObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedCompanyObject { /** The unique identifier for the company which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted. - `company` */ - object?: "company"; + object?: "company" | undefined; /** Whether the company was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/DeletedInternalArticleObject.ts b/src/api/resources/unstable/types/DeletedInternalArticleObject.ts index 47d5060b..fec945c6 100644 --- a/src/api/resources/unstable/types/DeletedInternalArticleObject.ts +++ b/src/api/resources/unstable/types/DeletedInternalArticleObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedInternalArticleObject { /** The unique identifier for the internal article which you provided in the URL. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted. - internal_article */ - object?: "internal_article"; + object?: "internal_article" | undefined; /** Whether the internal article was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/DeletedObject.ts b/src/api/resources/unstable/types/DeletedObject.ts index a22b393b..7b8ff435 100644 --- a/src/api/resources/unstable/types/DeletedObject.ts +++ b/src/api/resources/unstable/types/DeletedObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedObject { /** The unique identifier for the news item which you provided in the URL. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted - news-item. */ - object?: "news-item"; + object?: "news-item" | undefined; /** Whether the news item was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/resources/unstable/types/EmailAddressHeader.ts b/src/api/resources/unstable/types/EmailAddressHeader.ts index 7e8d234d..82585c50 100644 --- a/src/api/resources/unstable/types/EmailAddressHeader.ts +++ b/src/api/resources/unstable/types/EmailAddressHeader.ts @@ -5,9 +5,9 @@ */ export interface EmailAddressHeader { /** The type of email address header */ - type?: string; + type?: string | undefined; /** The email address */ - email_address?: string; + email_address?: string | undefined; /** The name associated with the email address */ - name?: string; + name?: string | undefined; } diff --git a/src/api/resources/unstable/types/EmailMessageMetadata.ts b/src/api/resources/unstable/types/EmailMessageMetadata.ts index 022108cf..31e9bde2 100644 --- a/src/api/resources/unstable/types/EmailMessageMetadata.ts +++ b/src/api/resources/unstable/types/EmailMessageMetadata.ts @@ -7,9 +7,9 @@ import type * as Intercom from "../../../index.js"; */ export interface EmailMessageMetadata { /** The subject of the email */ - subject?: string; + subject?: string | undefined; /** A list of an email address headers. */ - email_address_headers?: Intercom.unstable.EmailAddressHeader[]; + email_address_headers?: Intercom.unstable.EmailAddressHeader[] | undefined; /** The unique identifier for the email message as specified in the Message-ID header */ - message_id?: string; + message_id?: string | undefined; } diff --git a/src/api/resources/unstable/types/Error_.ts b/src/api/resources/unstable/types/Error_.ts index 91e726ed..a5eda0ca 100644 --- a/src/api/resources/unstable/types/Error_.ts +++ b/src/api/resources/unstable/types/Error_.ts @@ -6,8 +6,7 @@ export interface Error_ { /** The type is error.list */ type: string; - /** */ - request_id?: string; + request_id?: string | undefined; /** An array of one or more error objects */ errors: Error_.Errors.Item[]; } @@ -20,9 +19,9 @@ export namespace Error_ { /** A string indicating the kind of error, used to further qualify the HTTP response code */ code: string; /** Optional. Human readable description of the error. */ - message?: string; + message?: string | undefined; /** Optional. Used to identify a particular field or query parameter that was in error. */ - field?: string; + field?: string | undefined; } } } diff --git a/src/api/resources/unstable/types/FileAttribute.ts b/src/api/resources/unstable/types/FileAttribute.ts index b8fab036..9c306bee 100644 --- a/src/api/resources/unstable/types/FileAttribute.ts +++ b/src/api/resources/unstable/types/FileAttribute.ts @@ -4,17 +4,17 @@ * The value describing a file upload set for a custom attribute */ export interface FileAttribute { - type?: string; + type?: string | undefined; /** The name of the file */ - name?: string; + name?: string | undefined; /** The url of the file. This is a temporary URL and will expire after 30 minutes. */ - url?: string; + url?: string | undefined; /** The type of file */ - content_type?: string; + content_type?: string | undefined; /** The size of the file in bytes */ - filesize?: number; + filesize?: number | undefined; /** The width of the file in pixels, if applicable */ - width?: number; + width?: number | undefined; /** The height of the file in pixels, if applicable */ - height?: number; + height?: number | undefined; } diff --git a/src/api/resources/unstable/types/GroupContent.ts b/src/api/resources/unstable/types/GroupContent.ts index 68c5b320..3aa3f5fb 100644 --- a/src/api/resources/unstable/types/GroupContent.ts +++ b/src/api/resources/unstable/types/GroupContent.ts @@ -5,9 +5,9 @@ */ export interface GroupContent { /** The type of object - `group_content` . */ - type?: "group_content"; + type?: "group_content" | undefined; /** The name of the collection or section. */ - name?: string; + name?: string | undefined; /** The description of the collection. Only available for collections. */ - description?: string; + description?: string | undefined; } diff --git a/src/api/resources/unstable/types/GroupTranslatedContent.ts b/src/api/resources/unstable/types/GroupTranslatedContent.ts index c7b9933b..ac1a636f 100644 --- a/src/api/resources/unstable/types/GroupTranslatedContent.ts +++ b/src/api/resources/unstable/types/GroupTranslatedContent.ts @@ -7,79 +7,79 @@ import type * as Intercom from "../../../index.js"; */ export interface GroupTranslatedContent { /** The type of object - group_translated_content. */ - type?: "group_translated_content"; + type?: "group_translated_content" | undefined; /** The content of the group in Arabic */ - ar?: Intercom.unstable.GroupContent; + ar?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Bulgarian */ - bg?: Intercom.unstable.GroupContent; + bg?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Bosnian */ - bs?: Intercom.unstable.GroupContent; + bs?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Catalan */ - ca?: Intercom.unstable.GroupContent; + ca?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Czech */ - cs?: Intercom.unstable.GroupContent; + cs?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Danish */ - da?: Intercom.unstable.GroupContent; + da?: Intercom.unstable.GroupContent | undefined; /** The content of the group in German */ - de?: Intercom.unstable.GroupContent; + de?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Greek */ - el?: Intercom.unstable.GroupContent; + el?: Intercom.unstable.GroupContent | undefined; /** The content of the group in English */ - en?: Intercom.unstable.GroupContent; + en?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Spanish */ - es?: Intercom.unstable.GroupContent; + es?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Estonian */ - et?: Intercom.unstable.GroupContent; + et?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Finnish */ - fi?: Intercom.unstable.GroupContent; + fi?: Intercom.unstable.GroupContent | undefined; /** The content of the group in French */ - fr?: Intercom.unstable.GroupContent; + fr?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Hebrew */ - he?: Intercom.unstable.GroupContent; + he?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Croatian */ - hr?: Intercom.unstable.GroupContent; + hr?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Hungarian */ - hu?: Intercom.unstable.GroupContent; + hu?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Indonesian */ - id?: Intercom.unstable.GroupContent; + id?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Italian */ - it?: Intercom.unstable.GroupContent; + it?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Japanese */ - ja?: Intercom.unstable.GroupContent; + ja?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Korean */ - ko?: Intercom.unstable.GroupContent; + ko?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Lithuanian */ - lt?: Intercom.unstable.GroupContent; + lt?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Latvian */ - lv?: Intercom.unstable.GroupContent; + lv?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Mongolian */ - mn?: Intercom.unstable.GroupContent; + mn?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Norwegian */ - nb?: Intercom.unstable.GroupContent; + nb?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Dutch */ - nl?: Intercom.unstable.GroupContent; + nl?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Polish */ - pl?: Intercom.unstable.GroupContent; + pl?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Portuguese (Portugal) */ - pt?: Intercom.unstable.GroupContent; + pt?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Romanian */ - ro?: Intercom.unstable.GroupContent; + ro?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Russian */ - ru?: Intercom.unstable.GroupContent; + ru?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Slovenian */ - sl?: Intercom.unstable.GroupContent; + sl?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Serbian */ - sr?: Intercom.unstable.GroupContent; + sr?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Swedish */ - sv?: Intercom.unstable.GroupContent; + sv?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Turkish */ - tr?: Intercom.unstable.GroupContent; + tr?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Vietnamese */ - vi?: Intercom.unstable.GroupContent; + vi?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Portuguese (Brazil) */ - "pt-BR"?: Intercom.unstable.GroupContent; + "pt-BR"?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Chinese (China) */ - "zh-CN"?: Intercom.unstable.GroupContent; + "zh-CN"?: Intercom.unstable.GroupContent | undefined; /** The content of the group in Chinese (Taiwan) */ - "zh-TW"?: Intercom.unstable.GroupContent; + "zh-TW"?: Intercom.unstable.GroupContent | undefined; } diff --git a/src/api/resources/unstable/types/HandlingEvent.ts b/src/api/resources/unstable/types/HandlingEvent.ts index f6d3e9d6..39de99b4 100644 --- a/src/api/resources/unstable/types/HandlingEvent.ts +++ b/src/api/resources/unstable/types/HandlingEvent.ts @@ -12,7 +12,7 @@ export interface HandlingEvent { /** ISO8601 timestamp when the event occurred */ timestamp: string; /** Optional reason for the event (e.g., "Paused", "Away") */ - reason?: string; + reason?: string | undefined; } export namespace HandlingEvent { diff --git a/src/api/resources/unstable/types/HandlingEventList.ts b/src/api/resources/unstable/types/HandlingEventList.ts index 57dfe2d2..e42a5f3b 100644 --- a/src/api/resources/unstable/types/HandlingEventList.ts +++ b/src/api/resources/unstable/types/HandlingEventList.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../../../index.js"; */ export interface HandlingEventList { /** Array of handling events */ - handling_events?: Intercom.unstable.HandlingEvent[]; + handling_events?: Intercom.unstable.HandlingEvent[] | undefined; } diff --git a/src/api/resources/unstable/types/InternalArticleList.ts b/src/api/resources/unstable/types/InternalArticleList.ts index 5f5f6df8..8a383a02 100644 --- a/src/api/resources/unstable/types/InternalArticleList.ts +++ b/src/api/resources/unstable/types/InternalArticleList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface InternalArticleList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.unstable.CursorPages; + type?: "list" | undefined; + pages?: Intercom.unstable.CursorPages | undefined; /** A count of the total number of internal articles. */ - total_count?: number; + total_count?: number | undefined; /** An array of Internal Article objects */ - data?: Intercom.unstable.InternalArticleListItem[]; + data?: Intercom.unstable.InternalArticleListItem[] | undefined; } diff --git a/src/api/resources/unstable/types/LinkedObject.ts b/src/api/resources/unstable/types/LinkedObject.ts index 27fe77b5..85dcbf9d 100644 --- a/src/api/resources/unstable/types/LinkedObject.ts +++ b/src/api/resources/unstable/types/LinkedObject.ts @@ -5,11 +5,11 @@ */ export interface LinkedObject { /** ticket or conversation */ - type?: LinkedObject.Type; + type?: LinkedObject.Type | undefined; /** The ID of the linked object */ - id?: string; + id?: string | undefined; /** Category of the Linked Ticket Object. */ - category?: LinkedObject.Category; + category?: LinkedObject.Category | undefined; } export namespace LinkedObject { diff --git a/src/api/resources/unstable/types/LinkedObjectList.ts b/src/api/resources/unstable/types/LinkedObjectList.ts index b17171e1..3a966541 100644 --- a/src/api/resources/unstable/types/LinkedObjectList.ts +++ b/src/api/resources/unstable/types/LinkedObjectList.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../../../index.js"; */ export interface LinkedObjectList { /** Always list. */ - type?: "list"; + type?: "list" | undefined; /** The total number of linked objects. */ - total_count?: number; + total_count?: number | undefined; /** Whether or not there are more linked objects than returned. */ - has_more?: boolean; + has_more?: boolean | undefined; /** An array containing the linked conversations and linked tickets. */ - data?: Intercom.unstable.LinkedObject[]; + data?: Intercom.unstable.LinkedObject[] | undefined; } diff --git a/src/api/resources/unstable/types/Metadata.ts b/src/api/resources/unstable/types/Metadata.ts new file mode 100644 index 00000000..add0f1ba --- /dev/null +++ b/src/api/resources/unstable/types/Metadata.ts @@ -0,0 +1,5 @@ +// This file was auto-generated by Fern from our API Definition. + +import type * as Intercom from "../../../index.js"; + +export type Metadata = Intercom.unstable.ConversationPartMetadata; diff --git a/src/api/resources/unstable/types/MultipleFilterSearchRequest.ts b/src/api/resources/unstable/types/MultipleFilterSearchRequest.ts index 4d834701..5741b5c3 100644 --- a/src/api/resources/unstable/types/MultipleFilterSearchRequest.ts +++ b/src/api/resources/unstable/types/MultipleFilterSearchRequest.ts @@ -7,8 +7,8 @@ import type * as Intercom from "../../../index.js"; */ export interface MultipleFilterSearchRequest { /** An operator to allow boolean inspection between multiple fields. */ - operator?: MultipleFilterSearchRequest.Operator; - value?: MultipleFilterSearchRequest.Value; + operator?: MultipleFilterSearchRequest.Operator | undefined; + value?: MultipleFilterSearchRequest.Value | undefined; } export namespace MultipleFilterSearchRequest { diff --git a/src/api/resources/unstable/types/NewsItemRequest.ts b/src/api/resources/unstable/types/NewsItemRequest.ts index 9735b4fc..de201822 100644 --- a/src/api/resources/unstable/types/NewsItemRequest.ts +++ b/src/api/resources/unstable/types/NewsItemRequest.ts @@ -9,19 +9,19 @@ export interface NewsItemRequest { /** The title of the news item. */ title: string; /** The news item body, which may contain HTML. */ - body?: string; + body?: string | undefined; /** The id of the sender of the news item. Must be a teammate on the workspace. */ sender_id: number; /** News items will not be visible to your users in the assigned newsfeeds until they are set live. */ - state?: NewsItemRequest.State; + state?: NewsItemRequest.State | undefined; /** When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. */ - deliver_silently?: boolean; + deliver_silently?: boolean | undefined; /** Label names displayed to users to categorize the news item. */ - labels?: string[]; + labels?: string[] | undefined; /** Ordered list of emoji reactions to the news item. When empty, reactions are disabled. */ - reactions?: (string | undefined)[]; + reactions?: (string | undefined)[] | undefined; /** A list of newsfeed_assignments to assign to the specified newsfeed. */ - newsfeed_assignments?: Intercom.unstable.NewsfeedAssignment[]; + newsfeed_assignments?: Intercom.unstable.NewsfeedAssignment[] | undefined; } export namespace NewsItemRequest { diff --git a/src/api/resources/unstable/types/NotFoundErrorBody.ts b/src/api/resources/unstable/types/NotFoundErrorBody.ts index de9109f3..eedb3a18 100644 --- a/src/api/resources/unstable/types/NotFoundErrorBody.ts +++ b/src/api/resources/unstable/types/NotFoundErrorBody.ts @@ -3,8 +3,7 @@ export interface NotFoundErrorBody { /** The type is error.list */ type: string; - /** */ - request_id?: string; + request_id?: string | undefined; /** An array of one or more error objects */ errors: NotFoundErrorBody.Errors.Item[]; } @@ -17,7 +16,7 @@ export namespace NotFoundErrorBody { /** ticket_not_found */ code: string; /** Ticket not found */ - message?: string; + message?: string | undefined; } } } diff --git a/src/api/resources/unstable/types/NoteList.ts b/src/api/resources/unstable/types/NoteList.ts index 0f1e8fe4..3eae8073 100644 --- a/src/api/resources/unstable/types/NoteList.ts +++ b/src/api/resources/unstable/types/NoteList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface NoteList { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** An array of notes. */ - data?: Intercom.unstable.Note[]; + data?: Intercom.unstable.Note[] | undefined; /** A count of the total number of notes. */ - total_count?: number; - pages?: Intercom.unstable.CursorPages; + total_count?: number | undefined; + pages?: Intercom.unstable.CursorPages | undefined; } diff --git a/src/api/resources/unstable/types/OperatorWorkflowEvent.ts b/src/api/resources/unstable/types/OperatorWorkflowEvent.ts index df8629d3..53ac48fe 100644 --- a/src/api/resources/unstable/types/OperatorWorkflowEvent.ts +++ b/src/api/resources/unstable/types/OperatorWorkflowEvent.ts @@ -4,20 +4,20 @@ * Contains details about name of the workflow for conversation part type operator_workflow_event. */ export interface OperatorWorkflowEvent { - workflow?: OperatorWorkflowEvent.Workflow; - event?: OperatorWorkflowEvent.Event; + workflow?: OperatorWorkflowEvent.Workflow | undefined; + event?: OperatorWorkflowEvent.Event | undefined; } export namespace OperatorWorkflowEvent { export interface Workflow { /** The name of the workflow */ - name?: string; + name?: string | undefined; } export interface Event { /** Type of the workflow event initiated */ - type?: string; + type?: string | undefined; /** Result of the workflow event */ - result?: string; + result?: string | undefined; } } diff --git a/src/api/resources/unstable/types/PagesLink.ts b/src/api/resources/unstable/types/PagesLink.ts index 59d698ff..4aa9fbe8 100644 --- a/src/api/resources/unstable/types/PagesLink.ts +++ b/src/api/resources/unstable/types/PagesLink.ts @@ -6,10 +6,10 @@ * Their responses are likely to contain a pages object that hosts pagination links which a client can use to paginate through the data without having to construct a query. The link relations for the pages field are as follows. */ export interface PagesLink { - type?: "pages"; - page?: number; + type?: "pages" | undefined; + page?: number | undefined; /** A link to the next page of results. A response that does not contain a next link does not have further data to fetch. */ - next?: string; - per_page?: number; - total_pages?: number; + next?: string | undefined; + per_page?: number | undefined; + total_pages?: number | undefined; } diff --git a/src/api/resources/unstable/types/PaginatedResponse.ts b/src/api/resources/unstable/types/PaginatedResponse.ts index 64972bf9..75430846 100644 --- a/src/api/resources/unstable/types/PaginatedResponse.ts +++ b/src/api/resources/unstable/types/PaginatedResponse.ts @@ -7,12 +7,12 @@ import type * as Intercom from "../../../index.js"; */ export interface PaginatedResponse { /** The type of object */ - type?: PaginatedResponse.Type; - pages?: Intercom.unstable.CursorPages; + type?: PaginatedResponse.Type | undefined; + pages?: Intercom.unstable.CursorPages | undefined; /** A count of the total number of objects. */ - total_count?: number; + total_count?: number | undefined; /** An array of Objects */ - data?: Intercom.unstable.PaginatedResponseDataItem[]; + data?: Intercom.unstable.PaginatedResponseDataItem[] | undefined; } export namespace PaginatedResponse { diff --git a/src/api/resources/unstable/types/PartAttachment.ts b/src/api/resources/unstable/types/PartAttachment.ts index 3c01b778..984803cd 100644 --- a/src/api/resources/unstable/types/PartAttachment.ts +++ b/src/api/resources/unstable/types/PartAttachment.ts @@ -5,17 +5,17 @@ */ export interface PartAttachment { /** The type of attachment */ - type?: string; + type?: string | undefined; /** The name of the attachment */ - name?: string; + name?: string | undefined; /** The URL of the attachment */ - url?: string; + url?: string | undefined; /** The content type of the attachment */ - content_type?: string; + content_type?: string | undefined; /** The size of the attachment */ - filesize?: number; + filesize?: number | undefined; /** The width of the attachment */ - width?: number; + width?: number | undefined; /** The height of the attachment */ - height?: number; + height?: number | undefined; } diff --git a/src/api/resources/unstable/types/PhoneSwitch.ts b/src/api/resources/unstable/types/PhoneSwitch.ts index 5fbeb892..41e7d028 100644 --- a/src/api/resources/unstable/types/PhoneSwitch.ts +++ b/src/api/resources/unstable/types/PhoneSwitch.ts @@ -4,8 +4,7 @@ * Phone Switch Response */ export interface PhoneSwitch { - /** */ - type?: "phone_call_redirect"; + type?: "phone_call_redirect" | undefined; /** Phone number in E.164 format, that has received the SMS to continue the conversation in the Messenger. */ - phone?: string; + phone?: string | undefined; } diff --git a/src/api/resources/unstable/types/PriorityChanged.ts b/src/api/resources/unstable/types/PriorityChanged.ts index f09b55df..adea83da 100644 --- a/src/api/resources/unstable/types/PriorityChanged.ts +++ b/src/api/resources/unstable/types/PriorityChanged.ts @@ -5,9 +5,9 @@ */ export interface PriorityChanged { /** Current priority state */ - current_priority?: PriorityChanged.CurrentPriority; + current_priority?: PriorityChanged.CurrentPriority | undefined; /** Previous priority state */ - previous_priority?: PriorityChanged.PreviousPriority; + previous_priority?: PriorityChanged.PreviousPriority | undefined; } export namespace PriorityChanged { diff --git a/src/api/resources/unstable/types/Reference.ts b/src/api/resources/unstable/types/Reference.ts index 7c9c82a3..588d9ec5 100644 --- a/src/api/resources/unstable/types/Reference.ts +++ b/src/api/resources/unstable/types/Reference.ts @@ -4,8 +4,6 @@ * reference to another object */ export interface Reference { - /** */ - type?: string; - /** */ - id?: string; + type?: string | undefined; + id?: string | undefined; } diff --git a/src/api/resources/unstable/types/RegisterFinVoiceCallRequest.ts b/src/api/resources/unstable/types/RegisterFinVoiceCallRequest.ts index 2fd07f21..f011c929 100644 --- a/src/api/resources/unstable/types/RegisterFinVoiceCallRequest.ts +++ b/src/api/resources/unstable/types/RegisterFinVoiceCallRequest.ts @@ -9,9 +9,9 @@ export interface RegisterFinVoiceCallRequest { /** External call identifier from the call provider */ call_id: string; /** Source of the call. Can be "five9", "zoom_phone", or defaults to "aws_connect" */ - source?: RegisterFinVoiceCallRequest.Source; + source?: RegisterFinVoiceCallRequest.Source | undefined; /** Additional metadata about the call */ - data?: Record; + data?: Record | undefined; } export namespace RegisterFinVoiceCallRequest { diff --git a/src/api/resources/unstable/types/SearchRequest.ts b/src/api/resources/unstable/types/SearchRequest.ts index 796d8fc5..1fc34e22 100644 --- a/src/api/resources/unstable/types/SearchRequest.ts +++ b/src/api/resources/unstable/types/SearchRequest.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface SearchRequest { query: SearchRequest.Query; - pagination?: Intercom.unstable.StartingAfterPaging; + pagination?: Intercom.unstable.StartingAfterPaging | undefined; } export namespace SearchRequest { diff --git a/src/api/resources/unstable/types/SegmentList.ts b/src/api/resources/unstable/types/SegmentList.ts index 7a3ae83b..c43ca058 100644 --- a/src/api/resources/unstable/types/SegmentList.ts +++ b/src/api/resources/unstable/types/SegmentList.ts @@ -7,9 +7,9 @@ import type * as Intercom from "../../../index.js"; */ export interface SegmentList { /** The type of the object */ - type?: "segment.list"; + type?: "segment.list" | undefined; /** A list of Segment objects */ - segments?: Intercom.unstable.Segment[]; + segments?: Intercom.unstable.Segment[] | undefined; /** A pagination object, which may be empty, indicating no further pages to fetch. */ - pages?: Record; + pages?: Record | undefined; } diff --git a/src/api/resources/unstable/types/SingleFilterSearchRequest.ts b/src/api/resources/unstable/types/SingleFilterSearchRequest.ts index 58808cb4..db7625fc 100644 --- a/src/api/resources/unstable/types/SingleFilterSearchRequest.ts +++ b/src/api/resources/unstable/types/SingleFilterSearchRequest.ts @@ -5,11 +5,11 @@ */ export interface SingleFilterSearchRequest { /** The accepted field that you want to search on. */ - field?: string; + field?: string | undefined; /** The accepted operators you can use to define how you want to search for the value. */ - operator?: SingleFilterSearchRequest.Operator; + operator?: SingleFilterSearchRequest.Operator | undefined; /** The value that you want to search on. */ - value?: SingleFilterSearchRequest.Value; + value?: SingleFilterSearchRequest.Value | undefined; } export namespace SingleFilterSearchRequest { diff --git a/src/api/resources/unstable/types/SlaApplied.ts b/src/api/resources/unstable/types/SlaApplied.ts index 3ea77f62..615d9979 100644 --- a/src/api/resources/unstable/types/SlaApplied.ts +++ b/src/api/resources/unstable/types/SlaApplied.ts @@ -6,16 +6,16 @@ */ export interface SlaApplied { /** object type */ - type?: string; + type?: string | undefined; /** The name of the SLA as given by the teammate when it was created. */ - sla_name?: string; + sla_name?: string | undefined; /** * SLA statuses: * - `hit`: If there’s at least one hit event in the underlying sla_events table, and no “missed” or “canceled” events for the conversation. * - `missed`: If there are any missed sla_events for the conversation and no canceled events. If there’s even a single missed sla event, the status will always be missed. A missed status is not applied when the SLA expires, only the next time a teammate replies. * - `active`: An SLA has been applied to a conversation, but has not yet been fulfilled. SLA status is active only if there are no “hit, “missed”, or “canceled” events. */ - sla_status?: SlaApplied.SlaStatus; + sla_status?: SlaApplied.SlaStatus | undefined; } export namespace SlaApplied { diff --git a/src/api/resources/unstable/types/Snoozed.ts b/src/api/resources/unstable/types/Snoozed.ts index c8ea22fc..c094acd2 100644 --- a/src/api/resources/unstable/types/Snoozed.ts +++ b/src/api/resources/unstable/types/Snoozed.ts @@ -5,7 +5,7 @@ */ export interface Snoozed { /** Human-readable description of snooze duration */ - until?: string; + until?: string | undefined; /** ISO timestamp for custom snooze times (null for general snoozes) */ - custom_until_time?: string; + custom_until_time?: string | undefined; } diff --git a/src/api/resources/unstable/types/SocialProfile.ts b/src/api/resources/unstable/types/SocialProfile.ts index 5beba459..efaf197b 100644 --- a/src/api/resources/unstable/types/SocialProfile.ts +++ b/src/api/resources/unstable/types/SocialProfile.ts @@ -5,9 +5,9 @@ */ export interface SocialProfile { /** value is "social_profile" */ - type?: string; + type?: string | undefined; /** The name of the Social media profile */ - name?: string; + name?: string | undefined; /** The name of the Social media profile */ - url?: string; + url?: string | undefined; } diff --git a/src/api/resources/unstable/types/StartingAfterPaging.ts b/src/api/resources/unstable/types/StartingAfterPaging.ts index 6fc82b73..bddd3e4f 100644 --- a/src/api/resources/unstable/types/StartingAfterPaging.ts +++ b/src/api/resources/unstable/types/StartingAfterPaging.ts @@ -2,7 +2,7 @@ export interface StartingAfterPaging { /** The number of results to fetch per page. */ - per_page?: number; + per_page?: number | undefined; /** The cursor to use in the next request to get the next page of results. */ - starting_after?: string; + starting_after?: string | undefined; } diff --git a/src/api/resources/unstable/types/SubscriptionTypeList.ts b/src/api/resources/unstable/types/SubscriptionTypeList.ts index 977b74d8..c64be9b3 100644 --- a/src/api/resources/unstable/types/SubscriptionTypeList.ts +++ b/src/api/resources/unstable/types/SubscriptionTypeList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface SubscriptionTypeList { /** The type of the object */ - type?: "list"; + type?: "list" | undefined; /** A list of subscription type objects associated with the workspace . */ - data?: Intercom.unstable.SubscriptionType[]; + data?: Intercom.unstable.SubscriptionType[] | undefined; } diff --git a/src/api/resources/unstable/types/TagCompanyRequest.ts b/src/api/resources/unstable/types/TagCompanyRequest.ts index 4f4affb5..47f794d6 100644 --- a/src/api/resources/unstable/types/TagCompanyRequest.ts +++ b/src/api/resources/unstable/types/TagCompanyRequest.ts @@ -16,9 +16,9 @@ export namespace TagCompanyRequest { export namespace Companies { export interface Item { /** The Intercom defined id representing the company. */ - id?: string; + id?: string | undefined; /** The company id you have defined for the company. */ - company_id?: string; + company_id?: string | undefined; } } } diff --git a/src/api/resources/unstable/types/TagList.ts b/src/api/resources/unstable/types/TagList.ts index 5aba89c4..b66af502 100644 --- a/src/api/resources/unstable/types/TagList.ts +++ b/src/api/resources/unstable/types/TagList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface TagList { /** The type of the object */ - type?: "list"; + type?: "list" | undefined; /** A list of tags objects associated with the workspace . */ - data?: Intercom.unstable.Tag[]; + data?: Intercom.unstable.Tag[] | undefined; } diff --git a/src/api/resources/unstable/types/TagMultipleUsersRequest.ts b/src/api/resources/unstable/types/TagMultipleUsersRequest.ts index fc697987..6599d3a4 100644 --- a/src/api/resources/unstable/types/TagMultipleUsersRequest.ts +++ b/src/api/resources/unstable/types/TagMultipleUsersRequest.ts @@ -15,7 +15,7 @@ export namespace TagMultipleUsersRequest { export namespace Users { export interface Item { /** The Intercom defined id representing the user. */ - id?: string; + id?: string | undefined; } } } diff --git a/src/api/resources/unstable/types/Tags.ts b/src/api/resources/unstable/types/Tags.ts index e968cf71..368faa8a 100644 --- a/src/api/resources/unstable/types/Tags.ts +++ b/src/api/resources/unstable/types/Tags.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface Tags { /** The type of the object */ - type?: "tag.list"; + type?: "tag.list" | undefined; /** A list of tags objects associated with the conversation. */ - tags?: Intercom.unstable.Tag[]; + tags?: Intercom.unstable.Tag[] | undefined; } diff --git a/src/api/resources/unstable/types/TeamList.ts b/src/api/resources/unstable/types/TeamList.ts index c711e412..5bdbc9da 100644 --- a/src/api/resources/unstable/types/TeamList.ts +++ b/src/api/resources/unstable/types/TeamList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface TeamList { /** The type of the object */ - type?: "team.list"; + type?: "team.list" | undefined; /** A list of team objects */ - teams?: Intercom.unstable.Team[]; + teams?: Intercom.unstable.Team[] | undefined; } diff --git a/src/api/resources/unstable/types/TeamPriorityLevel.ts b/src/api/resources/unstable/types/TeamPriorityLevel.ts index 07d6bae5..47d67433 100644 --- a/src/api/resources/unstable/types/TeamPriorityLevel.ts +++ b/src/api/resources/unstable/types/TeamPriorityLevel.ts @@ -5,7 +5,7 @@ */ export interface TeamPriorityLevel { /** The primary team ids for the team */ - primary_team_ids?: number[]; + primary_team_ids?: number[] | undefined; /** The secondary team ids for the team */ - secondary_team_ids?: number[]; + secondary_team_ids?: number[] | undefined; } diff --git a/src/api/resources/unstable/types/TeammateReference.ts b/src/api/resources/unstable/types/TeammateReference.ts index 913ea0b2..7d3db498 100644 --- a/src/api/resources/unstable/types/TeammateReference.ts +++ b/src/api/resources/unstable/types/TeammateReference.ts @@ -11,7 +11,7 @@ export interface TeammateReference { /** The display name of the teammate */ name: string; /** The email address of the teammate (optional for teams/bots) */ - email?: string; + email?: string | undefined; } export namespace TeammateReference { diff --git a/src/api/resources/unstable/types/TicketList.ts b/src/api/resources/unstable/types/TicketList.ts index b1545342..ccb406ca 100644 --- a/src/api/resources/unstable/types/TicketList.ts +++ b/src/api/resources/unstable/types/TicketList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketList { /** Always ticket.list */ - type?: "ticket.list"; + type?: "ticket.list" | undefined; /** The list of ticket objects */ - tickets?: (Intercom.unstable.Ticket | undefined)[]; + tickets?: (Intercom.unstable.Ticket | undefined)[] | undefined; /** A count of the total number of objects. */ - total_count?: number; - pages?: Intercom.unstable.CursorPages; + total_count?: number | undefined; + pages?: Intercom.unstable.CursorPages | undefined; } diff --git a/src/api/resources/unstable/types/TicketPartAuthor.ts b/src/api/resources/unstable/types/TicketPartAuthor.ts index e0ea7ff3..38a5477f 100644 --- a/src/api/resources/unstable/types/TicketPartAuthor.ts +++ b/src/api/resources/unstable/types/TicketPartAuthor.ts @@ -5,13 +5,13 @@ */ export interface TicketPartAuthor { /** The type of the author */ - type?: TicketPartAuthor.Type; + type?: TicketPartAuthor.Type | undefined; /** The id of the author */ - id?: string; + id?: string | undefined; /** The name of the author */ - name?: string; + name?: string | undefined; /** The email of the author */ - email?: string; + email?: string | undefined; } export namespace TicketPartAuthor { diff --git a/src/api/resources/unstable/types/TicketParts.ts b/src/api/resources/unstable/types/TicketParts.ts index 95c99271..e957cce0 100644 --- a/src/api/resources/unstable/types/TicketParts.ts +++ b/src/api/resources/unstable/types/TicketParts.ts @@ -6,10 +6,8 @@ import type * as Intercom from "../../../index.js"; * A list of Ticket Part objects for each note and event in the ticket. There is a limit of 500 parts. */ export interface TicketParts { - /** */ - type?: "ticket_part.list"; + type?: "ticket_part.list" | undefined; /** A list of Ticket Part objects for each ticket. There is a limit of 500 parts. */ - ticket_parts?: Intercom.unstable.TicketPart[]; - /** */ - total_count?: number; + ticket_parts?: Intercom.unstable.TicketPart[] | undefined; + total_count?: number | undefined; } diff --git a/src/api/resources/unstable/types/TicketReply.ts b/src/api/resources/unstable/types/TicketReply.ts index 1a648076..5ce2a5d9 100644 --- a/src/api/resources/unstable/types/TicketReply.ts +++ b/src/api/resources/unstable/types/TicketReply.ts @@ -7,22 +7,22 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketReply { /** Always ticket_part */ - type?: "ticket_part"; + type?: "ticket_part" | undefined; /** The id representing the part. */ - id?: string; + id?: string | undefined; /** Type of the part */ - part_type?: TicketReply.PartType; + part_type?: TicketReply.PartType | undefined; /** The message body, which may contain HTML. */ - body?: string; + body?: string | undefined; /** The time the note was created. */ - created_at?: number; + created_at?: number | undefined; /** The last time the note was updated. */ - updated_at?: number; - author?: Intercom.unstable.TicketPartAuthor; + updated_at?: number | undefined; + author?: Intercom.unstable.TicketPartAuthor | undefined; /** A list of attachments for the part. */ - attachments?: Intercom.unstable.PartAttachment[]; + attachments?: Intercom.unstable.PartAttachment[] | undefined; /** Whether or not the ticket part has been redacted. */ - redacted?: boolean; + redacted?: boolean | undefined; } export namespace TicketReply { diff --git a/src/api/resources/unstable/types/TicketStateList.ts b/src/api/resources/unstable/types/TicketStateList.ts index 51e43516..6996e305 100644 --- a/src/api/resources/unstable/types/TicketStateList.ts +++ b/src/api/resources/unstable/types/TicketStateList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketStateList { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of ticket states associated with a given ticket type. */ - data?: (Intercom.unstable.TicketStateDetailed | undefined)[]; + data?: (Intercom.unstable.TicketStateDetailed | undefined)[] | undefined; } diff --git a/src/api/resources/unstable/types/TicketTypeAttribute.ts b/src/api/resources/unstable/types/TicketTypeAttribute.ts index f634dd96..fd50f7a2 100644 --- a/src/api/resources/unstable/types/TicketTypeAttribute.ts +++ b/src/api/resources/unstable/types/TicketTypeAttribute.ts @@ -5,37 +5,37 @@ */ export interface TicketTypeAttribute { /** String representing the object's type. Always has the value `ticket_type_attribute`. */ - type?: string; + type?: string | undefined; /** The id representing the ticket type attribute. */ - id?: string; + id?: string | undefined; /** The id of the workspace that the ticket type attribute belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The name of the ticket type attribute */ - name?: string; + name?: string | undefined; /** The description of the ticket type attribute */ - description?: string; + description?: string | undefined; /** The type of the data attribute (allowed values: "string list integer decimal boolean datetime files") */ - data_type?: string; + data_type?: string | undefined; /** Input options for the attribute */ - input_options?: Record; + input_options?: Record | undefined; /** The order of the attribute against other attributes */ - order?: number; + order?: number | undefined; /** Whether the attribute is required or not for teammates. */ - required_to_create?: boolean; + required_to_create?: boolean | undefined; /** Whether the attribute is required or not for contacts. */ - required_to_create_for_contacts?: boolean; + required_to_create_for_contacts?: boolean | undefined; /** Whether the attribute is visible or not to teammates. */ - visible_on_create?: boolean; + visible_on_create?: boolean | undefined; /** Whether the attribute is visible or not to contacts. */ - visible_to_contacts?: boolean; + visible_to_contacts?: boolean | undefined; /** Whether the attribute is built in or not. */ - default?: boolean; + default?: boolean | undefined; /** The id of the ticket type that the attribute belongs to. */ - ticket_type_id?: number; + ticket_type_id?: number | undefined; /** Whether the ticket type attribute is archived or not. */ - archived?: boolean; + archived?: boolean | undefined; /** The date and time the ticket type attribute was created. */ - created_at?: number; + created_at?: number | undefined; /** The date and time the ticket type attribute was last updated. */ - updated_at?: number; + updated_at?: number | undefined; } diff --git a/src/api/resources/unstable/types/TicketTypeAttributeList.ts b/src/api/resources/unstable/types/TicketTypeAttributeList.ts index 1466cda0..44d63ab9 100644 --- a/src/api/resources/unstable/types/TicketTypeAttributeList.ts +++ b/src/api/resources/unstable/types/TicketTypeAttributeList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketTypeAttributeList { /** String representing the object's type. Always has the value `ticket_type_attributes.list`. */ - type?: string; + type?: string | undefined; /** A list of ticket type attributes associated with a given ticket type. */ - ticket_type_attributes?: (Intercom.unstable.TicketTypeAttribute | undefined)[]; + ticket_type_attributes?: (Intercom.unstable.TicketTypeAttribute | undefined)[] | undefined; } diff --git a/src/api/resources/unstable/types/TicketTypeList.ts b/src/api/resources/unstable/types/TicketTypeList.ts index 7b839c67..40d03926 100644 --- a/src/api/resources/unstable/types/TicketTypeList.ts +++ b/src/api/resources/unstable/types/TicketTypeList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../../../index.js"; */ export interface TicketTypeList { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of ticket_types associated with a given workspace. */ - data?: (Intercom.unstable.TicketType | undefined)[]; + data?: (Intercom.unstable.TicketType | undefined)[] | undefined; } diff --git a/src/api/resources/unstable/types/Translation.ts b/src/api/resources/unstable/types/Translation.ts index 3d656a16..d1edad05 100644 --- a/src/api/resources/unstable/types/Translation.ts +++ b/src/api/resources/unstable/types/Translation.ts @@ -5,9 +5,9 @@ */ export interface Translation { /** The localised name of the subscription type. */ - name?: string; + name?: string | undefined; /** The localised description of the subscription type. */ - description?: string; + description?: string | undefined; /** The two character identifier for the language of the translation object. */ - locale?: string; + locale?: string | undefined; } diff --git a/src/api/resources/unstable/types/UntagCompanyRequest.ts b/src/api/resources/unstable/types/UntagCompanyRequest.ts index 09886bd1..d0d73881 100644 --- a/src/api/resources/unstable/types/UntagCompanyRequest.ts +++ b/src/api/resources/unstable/types/UntagCompanyRequest.ts @@ -16,11 +16,11 @@ export namespace UntagCompanyRequest { export namespace Companies { export interface Item { /** The Intercom defined id representing the company. */ - id?: string; + id?: string | undefined; /** The company id you have defined for the company. */ - company_id?: string; + company_id?: string | undefined; /** Always set to true */ - untag?: boolean; + untag?: boolean | undefined; } } } diff --git a/src/api/resources/unstable/types/UpdateDataAttributeRequestBody.ts b/src/api/resources/unstable/types/UpdateDataAttributeRequestBody.ts index 6524ae99..81ebba1b 100644 --- a/src/api/resources/unstable/types/UpdateDataAttributeRequestBody.ts +++ b/src/api/resources/unstable/types/UpdateDataAttributeRequestBody.ts @@ -1,8 +1,5 @@ // This file was auto-generated by Fern from our API Definition. -/** - * - */ export type UpdateDataAttributeRequestBody = | { options: { diff --git a/src/api/resources/unstable/types/UpdateVisitorRequest.ts b/src/api/resources/unstable/types/UpdateVisitorRequest.ts new file mode 100644 index 00000000..e2167c76 --- /dev/null +++ b/src/api/resources/unstable/types/UpdateVisitorRequest.ts @@ -0,0 +1,6 @@ +// This file was auto-generated by Fern from our API Definition. + +/** + * Update an existing visitor. + */ +export type UpdateVisitorRequest = unknown; diff --git a/src/api/resources/unstable/types/Visitor.ts b/src/api/resources/unstable/types/Visitor.ts index 32dcf169..9022d007 100644 --- a/src/api/resources/unstable/types/Visitor.ts +++ b/src/api/resources/unstable/types/Visitor.ts @@ -7,110 +7,108 @@ import type * as Intercom from "../../../index.js"; */ export interface Visitor { /** Value is 'visitor' */ - type?: string; + type?: string | undefined; /** The Intercom defined id representing the Visitor. */ - id?: string; + id?: string | undefined; /** Automatically generated identifier for the Visitor. */ - user_id?: string; + user_id?: string | undefined; /** Identifies if this visitor is anonymous. */ - anonymous?: boolean; + anonymous?: boolean | undefined; /** The email of the visitor. */ - email?: string; + email?: string | undefined; /** The phone number of the visitor. */ - phone?: string; + phone?: string | undefined; /** The name of the visitor. */ - name?: string; + name?: string | undefined; /** The pseudonym of the visitor. */ - pseudonym?: string; - avatar?: Visitor.Avatar; + pseudonym?: string | undefined; + avatar?: Visitor.Avatar | undefined; /** The id of the app the visitor is associated with. */ - app_id?: string; - companies?: Visitor.Companies; - location_data?: Visitor.LocationData; + app_id?: string | undefined; + companies?: Visitor.Companies | undefined; + location_data?: Visitor.LocationData | undefined; /** The time the Lead last recorded making a request. */ - las_request_at?: number; + las_request_at?: number | undefined; /** The time the Visitor was added to Intercom. */ - created_at?: number; + created_at?: number | undefined; /** The time the Visitor was added to Intercom. */ - remote_created_at?: number; + remote_created_at?: number | undefined; /** The time the Visitor signed up for your product. */ - signed_up_at?: number; + signed_up_at?: number | undefined; /** The last time the Visitor was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The number of sessions the Visitor has had. */ - session_count?: number; - social_profiles?: Visitor.SocialProfiles; + session_count?: number | undefined; + social_profiles?: Visitor.SocialProfiles | undefined; /** The id of the admin that owns the Visitor. */ - owner_id?: string; + owner_id?: string | undefined; /** Whether the Visitor is unsubscribed from emails. */ - unsubscribed_from_emails?: boolean; + unsubscribed_from_emails?: boolean | undefined; /** Identifies if this visitor has marked an email as spam. */ - marked_email_as_spam?: boolean; + marked_email_as_spam?: boolean | undefined; /** Identifies if this visitor has had a hard bounce. */ - has_hard_bounced?: boolean; - tags?: Visitor.Tags; - segments?: Visitor.Segments; + has_hard_bounced?: boolean | undefined; + tags?: Visitor.Tags | undefined; + segments?: Visitor.Segments | undefined; /** The custom attributes you have set on the Visitor. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; /** The referer of the visitor. */ - referrer?: string; + referrer?: string | undefined; /** The utm_campaign of the visitor. */ - utm_campaign?: string; + utm_campaign?: string | undefined; /** The utm_content of the visitor. */ - utm_content?: string; + utm_content?: string | undefined; /** The utm_medium of the visitor. */ - utm_medium?: string; + utm_medium?: string | undefined; /** The utm_source of the visitor. */ - utm_source?: string; + utm_source?: string | undefined; /** The utm_term of the visitor. */ - utm_term?: string; + utm_term?: string | undefined; /** Identifies if this visitor has do not track enabled. */ - do_not_track?: boolean; + do_not_track?: boolean | undefined; } export namespace Visitor { export interface Avatar { - /** */ - type?: string; + type?: string | undefined; /** This object represents the avatar associated with the visitor. */ - image_url?: string; + image_url?: string | undefined; } export interface Companies { /** The type of the object */ - type?: "company.list"; - companies?: Intercom.unstable.Company[]; + type?: "company.list" | undefined; + companies?: Intercom.unstable.Company[] | undefined; } export interface LocationData { - /** */ - type?: string; + type?: string | undefined; /** The city name of the visitor. */ - city_name?: string; + city_name?: string | undefined; /** The continent code of the visitor. */ - continent_code?: string; + continent_code?: string | undefined; /** The country code of the visitor. */ - country_code?: string; + country_code?: string | undefined; /** The country name of the visitor. */ - country_name?: string; + country_name?: string | undefined; /** The postal code of the visitor. */ - postal_code?: string; + postal_code?: string | undefined; /** The region name of the visitor. */ - region_name?: string; + region_name?: string | undefined; /** The timezone of the visitor. */ - timezone?: string; + timezone?: string | undefined; } export interface SocialProfiles { /** The type of the object */ - type?: "social_profile.list"; - social_profiles?: string[]; + type?: "social_profile.list" | undefined; + social_profiles?: string[] | undefined; } export interface Tags { /** The type of the object */ - type?: "tag.list"; - tags?: Tags.Tags.Item[]; + type?: "tag.list" | undefined; + tags?: Tags.Tags.Item[] | undefined; } export namespace Tags { @@ -119,18 +117,18 @@ export namespace Visitor { export namespace Tags { export interface Item { /** The type of the object */ - type?: "tag"; + type?: "tag" | undefined; /** The id of the tag. */ - id?: string; + id?: string | undefined; /** The name of the tag. */ - name?: string; + name?: string | undefined; } } } export interface Segments { /** The type of the object */ - type?: "segment.list"; - segments?: string[]; + type?: "segment.list" | undefined; + segments?: string[] | undefined; } } diff --git a/src/api/resources/unstable/types/VisitorDeletedObject.ts b/src/api/resources/unstable/types/VisitorDeletedObject.ts index 6a3cc196..874c5a4c 100644 --- a/src/api/resources/unstable/types/VisitorDeletedObject.ts +++ b/src/api/resources/unstable/types/VisitorDeletedObject.ts @@ -5,9 +5,9 @@ */ export interface VisitorDeletedObject { /** The unique identifier for the visitor which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted */ - type?: "visitor"; + type?: "visitor" | undefined; /** Automatically generated identifier for the Visitor. */ - user_id?: string; + user_id?: string | undefined; } diff --git a/src/api/resources/unstable/types/WhatsappMessageStatusList.ts b/src/api/resources/unstable/types/WhatsappMessageStatusList.ts index b1d0e8d8..de1780e2 100644 --- a/src/api/resources/unstable/types/WhatsappMessageStatusList.ts +++ b/src/api/resources/unstable/types/WhatsappMessageStatusList.ts @@ -18,7 +18,7 @@ export namespace WhatsappMessageStatusList { /** Total number of pages */ total_pages: number; /** Information for fetching next page (null if no more pages) */ - next?: Pages.Next; + next?: Pages.Next | undefined; } export namespace Pages { @@ -27,7 +27,7 @@ export namespace WhatsappMessageStatusList { */ export interface Next { /** Cursor for the next page */ - starting_after?: string; + starting_after?: string | undefined; } } @@ -50,7 +50,7 @@ export namespace WhatsappMessageStatusList { /** WhatsApp's message identifier */ whatsapp_message_id: string; /** Name of the WhatsApp template used */ - template_name?: string; + template_name?: string | undefined; } export namespace Item { diff --git a/src/api/resources/unstable/types/WorkflowExport.ts b/src/api/resources/unstable/types/WorkflowExport.ts index 93531949..e47b55da 100644 --- a/src/api/resources/unstable/types/WorkflowExport.ts +++ b/src/api/resources/unstable/types/WorkflowExport.ts @@ -5,13 +5,13 @@ */ export interface WorkflowExport { /** The version of the export format. */ - export_version?: string; + export_version?: string | undefined; /** The timestamp when the export was generated. */ - exported_at?: string; + exported_at?: string | undefined; /** The workspace identifier. */ - app_id?: number; + app_id?: number | undefined; /** The workflow configuration. */ - workflow?: WorkflowExport.Workflow; + workflow?: WorkflowExport.Workflow | undefined; } export namespace WorkflowExport { @@ -20,31 +20,31 @@ export namespace WorkflowExport { */ export interface Workflow { /** The unique identifier for the workflow. */ - id?: string; + id?: string | undefined; /** The title of the workflow. */ - title?: string; + title?: string | undefined; /** The description of the workflow. */ - description?: string; + description?: string | undefined; /** The type of trigger that starts this workflow. */ - trigger_type?: string; + trigger_type?: string | undefined; /** The current state of the workflow. */ - state?: Workflow.State; + state?: Workflow.State | undefined; /** The channels this workflow targets. */ - target_channels?: string[]; + target_channels?: string[] | undefined; /** The preferred devices for this workflow. */ - preferred_devices?: string[]; + preferred_devices?: string[] | undefined; /** When the workflow was created. */ - created_at?: string; + created_at?: string | undefined; /** When the workflow was last updated. */ - updated_at?: string; + updated_at?: string | undefined; /** The targeting rules for this workflow. */ - targeting?: Record; + targeting?: Record | undefined; /** The current snapshot of workflow steps and configuration. */ - snapshot?: Record; + snapshot?: Record | undefined; /** Custom attributes defined for this workflow. */ - attributes?: Record[]; + attributes?: Record[] | undefined; /** Rules embedded within the workflow steps. */ - embedded_rules?: Record[]; + embedded_rules?: Record[] | undefined; } export namespace Workflow { diff --git a/src/api/resources/unstable/types/index.ts b/src/api/resources/unstable/types/index.ts index 5b8c268e..a9da57af 100644 --- a/src/api/resources/unstable/types/index.ts +++ b/src/api/resources/unstable/types/index.ts @@ -72,7 +72,9 @@ export * from "./ConversationStatistics.js"; export * from "./ConversationTagsUpdated.js"; export * from "./ConversationTeammates.js"; export * from "./CreateArticleRequest.js"; +export * from "./CreateContactRequest.js"; export * from "./CreateDataAttributeRequest.js"; +export * from "./CreateDataEventRequest.js"; export * from "./CreateInternalArticleRequest.js"; export * from "./CreateMessageRequest.js"; export * from "./CreateOrUpdateCompanyRequest.js"; @@ -115,6 +117,7 @@ export * from "./HandlingEventList.js"; export * from "./InternalArticleList.js"; export * from "./LinkedObject.js"; export * from "./LinkedObjectList.js"; +export * from "./Metadata.js"; export * from "./MultipleFilterSearchRequest.js"; export * from "./NewsItemRequest.js"; export * from "./NoteList.js"; @@ -162,6 +165,7 @@ export * from "./TicketTypeList.js"; export * from "./Translation.js"; export * from "./UntagCompanyRequest.js"; export * from "./UpdateDataAttributeRequestBody.js"; +export * from "./UpdateVisitorRequest.js"; export * from "./Visitor.js"; export * from "./VisitorDeletedObject.js"; export * from "./WhatsappMessageStatusList.js"; diff --git a/src/api/resources/visitors/client/Client.ts b/src/api/resources/visitors/client/Client.ts index 097e5ada..0ed17ae5 100644 --- a/src/api/resources/visitors/client/Client.ts +++ b/src/api/resources/visitors/client/Client.ts @@ -4,13 +4,14 @@ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClie import { type NormalizedClientOptionsWithAuth, normalizeClientOptionsWithAuth } from "../../../../BaseClient.js"; import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.js"; import * as core from "../../../../core/index.js"; +import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js"; import * as environments from "../../../../environments.js"; import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js"; import * as errors from "../../../../errors/index.js"; import * as Intercom from "../../../index.js"; export declare namespace VisitorsClient { - export interface Options extends BaseClientOptions {} + export type Options = BaseClientOptions; export interface RequestOptions extends BaseRequestOptions {} } @@ -33,6 +34,8 @@ export class VisitorsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.visitors.find({ @@ -51,8 +54,9 @@ export class VisitorsClient { requestOptions?: VisitorsClient.RequestOptions, ): Promise> { const { user_id: userId } = request; - const _queryParams: Record = {}; - _queryParams.user_id = userId; + const _queryParams: Record = { + user_id: userId, + }; const _authRequest: core.AuthRequest = await this._options.authProvider.getAuthRequest(); const _headers: core.Fetcher.Args["headers"] = mergeHeaders( _authRequest.headers, @@ -69,7 +73,11 @@ export class VisitorsClient { ), method: "GET", headers: _headers, - queryParameters: { ..._queryParams, ...requestOptions?.queryParams }, + queryString: core.url + .queryBuilder() + .addMany(_queryParams) + .mergeAdditional(requestOptions?.queryParams) + .build(), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -113,6 +121,8 @@ export class VisitorsClient { * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.visitors.update({ @@ -154,9 +164,9 @@ export class VisitorsClient { method: "PUT", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, @@ -199,6 +209,8 @@ export class VisitorsClient { * @param {VisitorsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} + * @throws {@link errors.IntercomError} + * @throws {@link errors.IntercomTimeoutError} * * @example * await client.visitors.mergeToContact({ @@ -240,9 +252,9 @@ export class VisitorsClient { method: "POST", headers: _headers, contentType: "application/json", - queryParameters: requestOptions?.queryParams, + queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(), requestType: "json", - body: request, + body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters), timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 20) * 1000, maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries, abortSignal: requestOptions?.abortSignal, diff --git a/src/api/resources/visitors/exports.ts b/src/api/resources/visitors/exports.ts new file mode 100644 index 00000000..5b7d947a --- /dev/null +++ b/src/api/resources/visitors/exports.ts @@ -0,0 +1,4 @@ +// This file was auto-generated by Fern from our API Definition. + +export { VisitorsClient } from "./client/Client.js"; +export * from "./client/index.js"; diff --git a/src/api/types/ActivityLog.ts b/src/api/types/ActivityLog.ts index eea2e6fd..4e29db28 100644 --- a/src/api/types/ActivityLog.ts +++ b/src/api/types/ActivityLog.ts @@ -7,15 +7,15 @@ import type * as Intercom from "../index.js"; */ export interface ActivityLog { /** The id representing the activity. */ - id?: string; + id?: string | undefined; /** Details about the Admin involved in the activity. */ - performed_by?: ActivityLog.PerformedBy; - metadata?: Intercom.ActivityLogMetadata; + performed_by?: ActivityLog.PerformedBy | undefined; + metadata?: Intercom.ActivityLogMetadata | undefined; /** The time the activity was created. */ - created_at?: number; - activity_type?: ActivityLog.ActivityType; + created_at?: number | undefined; + activity_type?: ActivityLog.ActivityType | undefined; /** A sentence or two describing the activity. */ - activity_description?: string; + activity_description?: string | undefined; } export namespace ActivityLog { @@ -24,13 +24,13 @@ export namespace ActivityLog { */ export interface PerformedBy { /** String representing the object's type. Always has the value `admin`. */ - type?: string; + type?: string | undefined; /** The id representing the admin. */ - id?: string; + id?: string | undefined; /** The email of the admin. */ - email?: string; + email?: string | undefined; /** The IP address of the admin. */ - ip?: string; + ip?: string | undefined; } export const ActivityType = { diff --git a/src/api/types/ActivityLogList.ts b/src/api/types/ActivityLogList.ts index 6a1253cc..420a9d6b 100644 --- a/src/api/types/ActivityLogList.ts +++ b/src/api/types/ActivityLogList.ts @@ -7,8 +7,8 @@ import type * as Intercom from "../index.js"; */ export interface ActivityLogList { /** String representing the object's type. Always has the value `activity_log.list`. */ - type?: string; - pages?: Intercom.CursorPages; + type?: string | undefined; + pages?: Intercom.CursorPages | undefined; /** An array of activity logs */ - activity_logs?: (Intercom.ActivityLog | undefined)[]; + activity_logs?: (Intercom.ActivityLog | undefined)[] | undefined; } diff --git a/src/api/types/ActivityLogMetadata.ts b/src/api/types/ActivityLogMetadata.ts index ed4bfcf2..676b8dd7 100644 --- a/src/api/types/ActivityLogMetadata.ts +++ b/src/api/types/ActivityLogMetadata.ts @@ -5,41 +5,41 @@ */ export interface ActivityLogMetadata { /** The way the admin signed in. */ - sign_in_method?: string; + sign_in_method?: string | undefined; /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; + external_id?: string | undefined; /** The away mode status which is set to true when away and false when returned. */ - away_mode?: boolean; + away_mode?: boolean | undefined; /** The reason the Admin is away. */ - away_status_reason?: string; + away_status_reason?: string | undefined; /** Indicates if conversations should be reassigned while an Admin is away. */ - reassign_conversations?: boolean; + reassign_conversations?: boolean | undefined; /** The action that initiated the status change. */ - source?: string; + source?: string | undefined; /** Indicates if the status was changed automatically or manually. */ - auto_changed?: string; + auto_changed?: string | undefined; /** The ID of the Admin who initiated the activity. */ - update_by?: number; + update_by?: number | undefined; /** The name of the Admin who initiated the activity. */ - update_by_name?: string; + update_by_name?: string | undefined; /** The conversation assignment limit value for an admin. */ - conversation_assignment_limit?: number; + conversation_assignment_limit?: number | undefined; /** The ticket assignment limit value for an admin. */ - ticket_assignment_limit?: number; + ticket_assignment_limit?: number | undefined; /** Details about the team whose assignment limit was changed. */ - team?: ActivityLogMetadata.Team; + team?: ActivityLogMetadata.Team | undefined; /** The team assignment limit value (null if limit was removed). */ - team_assignment_limit?: number; + team_assignment_limit?: number | undefined; /** Indicates if the setting is enabled or disabled. */ - enabled?: boolean; + enabled?: boolean | undefined; /** The ID of the impersonation consent. */ - consent_id?: number; + consent_id?: number | undefined; /** The timestamp when the impersonation consent expires. */ - expired_at?: string; + expired_at?: string | undefined; /** The state of settings or values before the change. Structure varies by activity type. */ - before?: Record; + before?: Record | undefined; /** The state of settings or values after the change. Structure varies by activity type. */ - after?: Record; + after?: Record | undefined; } export namespace ActivityLogMetadata { @@ -48,8 +48,8 @@ export namespace ActivityLogMetadata { */ export interface Team { /** The ID of the team. */ - id?: number; + id?: number | undefined; /** The name of the team. */ - name?: string; + name?: string | undefined; } } diff --git a/src/api/types/AddressableList.ts b/src/api/types/AddressableList.ts index cbda5a63..baced083 100644 --- a/src/api/types/AddressableList.ts +++ b/src/api/types/AddressableList.ts @@ -5,9 +5,9 @@ */ export interface AddressableList { /** The addressable object type */ - type?: string; + type?: string | undefined; /** The id of the addressable object */ - id?: string; + id?: string | undefined; /** Url to get more company resources for this contact */ - url?: string; + url?: string | undefined; } diff --git a/src/api/types/AdminList.ts b/src/api/types/AdminList.ts index c504537d..df9ec2f9 100644 --- a/src/api/types/AdminList.ts +++ b/src/api/types/AdminList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface AdminList { /** String representing the object's type. Always has the value `admin.list`. */ - type?: string; + type?: string | undefined; /** A list of admins associated with a given workspace. */ - admins?: (Intercom.Admin | undefined)[]; + admins?: (Intercom.Admin | undefined)[] | undefined; } diff --git a/src/api/types/AdminPriorityLevel.ts b/src/api/types/AdminPriorityLevel.ts index 1127dadf..f325b503 100644 --- a/src/api/types/AdminPriorityLevel.ts +++ b/src/api/types/AdminPriorityLevel.ts @@ -5,7 +5,7 @@ */ export interface AdminPriorityLevel { /** The primary admin ids for the team */ - primary_admin_ids?: number[]; + primary_admin_ids?: number[] | undefined; /** The secondary admin ids for the team */ - secondary_admin_ids?: number[]; + secondary_admin_ids?: number[] | undefined; } diff --git a/src/api/types/AdminReplyConversationRequest.ts b/src/api/types/AdminReplyConversationRequest.ts index 36982c2d..0f41ff99 100644 --- a/src/api/types/AdminReplyConversationRequest.ts +++ b/src/api/types/AdminReplyConversationRequest.ts @@ -9,17 +9,17 @@ export interface AdminReplyConversationRequest { message_type: AdminReplyConversationRequest.MessageType; type: "admin"; /** The text body of the reply. Notes accept some HTML formatting. Must be present for comment and note message types. */ - body?: string; + body?: string | undefined; /** The id of the admin who is authoring the comment. */ admin_id: string; /** The time the reply was created. If not provided, the current time will be used. */ - created_at?: number; + created_at?: number | undefined; /** The quick reply options to display to the end user. Must be present for quick_reply message types. */ - reply_options?: Intercom.QuickReplyOption[]; + reply_options?: Intercom.QuickReplyOption[] | undefined; /** A list of image URLs that will be added as attachments. You can include up to 10 URLs. */ - attachment_urls?: string[]; + attachment_urls?: string[] | undefined; /** A list of files that will be added as attachments. You can include up to 10 files */ - attachment_files?: Intercom.ConversationAttachmentFiles[]; + attachment_files?: Intercom.ConversationAttachmentFiles[] | undefined; } export namespace AdminReplyConversationRequest { diff --git a/src/api/types/AdminReplyTicketRequest.ts b/src/api/types/AdminReplyTicketRequest.ts index 3e2ac1ed..9f570c75 100644 --- a/src/api/types/AdminReplyTicketRequest.ts +++ b/src/api/types/AdminReplyTicketRequest.ts @@ -7,15 +7,15 @@ export interface AdminReplyTicketRequest { message_type: AdminReplyTicketRequest.MessageType; type: "admin"; /** The text body of the reply. Notes accept some HTML formatting. Must be present for comment and note message types. */ - body?: string; + body?: string | undefined; /** The id of the admin who is authoring the comment. */ admin_id: string; /** The time the reply was created. If not provided, the current time will be used. */ - created_at?: number; + created_at?: number | undefined; /** The quick reply options to display. Must be present for quick_reply message types. */ - reply_options?: AdminReplyTicketRequest.ReplyOptions.Item[]; + reply_options?: AdminReplyTicketRequest.ReplyOptions.Item[] | undefined; /** A list of image URLs that will be added as attachments. You can include up to 10 URLs. */ - attachment_urls?: string[]; + attachment_urls?: string[] | undefined; } export namespace AdminReplyTicketRequest { diff --git a/src/api/types/AdminWithApp.ts b/src/api/types/AdminWithApp.ts index 8675a421..43259de5 100644 --- a/src/api/types/AdminWithApp.ts +++ b/src/api/types/AdminWithApp.ts @@ -7,29 +7,29 @@ import type * as Intercom from "../index.js"; */ export interface AdminWithApp { /** String representing the object's type. Always has the value `admin`. */ - type?: string; + type?: string | undefined; /** The id representing the admin. */ - id?: string; + id?: string | undefined; /** The name of the admin. */ - name?: string; + name?: string | undefined; /** The email of the admin. */ - email?: string; + email?: string | undefined; /** The job title of the admin. */ - job_title?: string; + job_title?: string | undefined; /** Identifies if this admin is currently set in away mode. */ - away_mode_enabled?: boolean; + away_mode_enabled?: boolean | undefined; /** Identifies if this admin is set to automatically reassign new conversations to the apps default inbox. */ - away_mode_reassign?: boolean; + away_mode_reassign?: boolean | undefined; /** Identifies if this admin has a paid inbox seat to restrict/allow features that require them. */ - has_inbox_seat?: boolean; + has_inbox_seat?: boolean | undefined; /** This is a list of ids of the teams that this admin is part of. */ - team_ids?: number[]; + team_ids?: number[] | undefined; /** This object represents the avatar associated with the admin. */ - avatar?: AdminWithApp.Avatar; + avatar?: AdminWithApp.Avatar | undefined; /** Identifies if this admin's email is verified. */ - email_verified?: boolean; + email_verified?: boolean | undefined; /** App that the admin belongs to. */ - app?: Intercom.App; + app?: Intercom.App | undefined; } export namespace AdminWithApp { @@ -38,8 +38,8 @@ export namespace AdminWithApp { */ export interface Avatar { /** This is a string that identifies the type of the object. It will always have the value `avatar`. */ - type?: string; + type?: string | undefined; /** This object represents the avatar associated with the admin. */ - image_url?: string; + image_url?: string | undefined; } } diff --git a/src/api/types/App.ts b/src/api/types/App.ts index 67ce2d3c..092e2d52 100644 --- a/src/api/types/App.ts +++ b/src/api/types/App.ts @@ -4,18 +4,17 @@ * App is a workspace on Intercom */ export interface App { - /** */ - type?: string; + type?: string | undefined; /** The id of the app. */ - id_code?: string; + id_code?: string | undefined; /** The name of the app. */ - name?: string; + name?: string | undefined; /** The Intercom region the app is located in. */ - region?: string; + region?: string | undefined; /** The timezone of the region where the app is located. */ - timezone?: string; + timezone?: string | undefined; /** When the app was created. */ - created_at?: number; + created_at?: number | undefined; /** Whether or not the app uses identity verification. */ - identity_verification?: boolean; + identity_verification?: boolean | undefined; } diff --git a/src/api/types/ArticleContent.ts b/src/api/types/ArticleContent.ts index bccb5af5..fc728a41 100644 --- a/src/api/types/ArticleContent.ts +++ b/src/api/types/ArticleContent.ts @@ -5,23 +5,23 @@ */ export interface ArticleContent { /** The type of object - `article_content` . */ - type?: "article_content"; + type?: "article_content" | undefined; /** The title of the article. */ - title?: string; + title?: string | undefined; /** The description of the article. */ - description?: string; + description?: string | undefined; /** The body of the article. */ - body?: string; + body?: string | undefined; /** The ID of the author of the article. */ - author_id?: number; + author_id?: number | undefined; /** Whether the article is `published` or is a `draft` . */ - state?: ArticleContent.State; + state?: ArticleContent.State | undefined; /** The time when the article was created (seconds). */ - created_at?: number; + created_at?: number | undefined; /** The time when the article was last updated (seconds). */ - updated_at?: number; + updated_at?: number | undefined; /** The URL of the article. */ - url?: string; + url?: string | undefined; } export namespace ArticleContent { diff --git a/src/api/types/ArticleList.ts b/src/api/types/ArticleList.ts index 02eb730b..0f557bf6 100644 --- a/src/api/types/ArticleList.ts +++ b/src/api/types/ArticleList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface ArticleList { /** The type of the object - `list`. */ - type?: "list"; - pages?: unknown; + type?: "list" | undefined; + pages?: unknown | undefined; /** A count of the total number of articles. */ - total_count?: number; + total_count?: number | undefined; /** An array of Article objects */ - data?: Intercom.ArticleListItem[]; + data?: Intercom.ArticleListItem[] | undefined; } diff --git a/src/api/types/ArticleStatistics.ts b/src/api/types/ArticleStatistics.ts index 36ea843e..c0684546 100644 --- a/src/api/types/ArticleStatistics.ts +++ b/src/api/types/ArticleStatistics.ts @@ -9,7 +9,7 @@ export interface ArticleStatistics { /** The number of total views the article has received. */ views: number; /** The number of conversations started from the article. */ - conversions?: number; + conversions?: number | undefined; /** The number of total reactions the article has received. */ reactions: number; /** The percentage of happy reactions the article has received against other types of reaction. */ diff --git a/src/api/types/ArticleTranslatedContent.ts b/src/api/types/ArticleTranslatedContent.ts index 351d8148..3fc1a5b4 100644 --- a/src/api/types/ArticleTranslatedContent.ts +++ b/src/api/types/ArticleTranslatedContent.ts @@ -7,79 +7,79 @@ import type * as Intercom from "../index.js"; */ export interface ArticleTranslatedContent { /** The type of object - article_translated_content. */ - type?: "article_translated_content"; + type?: "article_translated_content" | undefined; /** The content of the article in Arabic */ - ar?: Intercom.ArticleContent; + ar?: Intercom.ArticleContent | undefined; /** The content of the article in Bulgarian */ - bg?: Intercom.ArticleContent; + bg?: Intercom.ArticleContent | undefined; /** The content of the article in Bosnian */ - bs?: Intercom.ArticleContent; + bs?: Intercom.ArticleContent | undefined; /** The content of the article in Catalan */ - ca?: Intercom.ArticleContent; + ca?: Intercom.ArticleContent | undefined; /** The content of the article in Czech */ - cs?: Intercom.ArticleContent; + cs?: Intercom.ArticleContent | undefined; /** The content of the article in Danish */ - da?: Intercom.ArticleContent; + da?: Intercom.ArticleContent | undefined; /** The content of the article in German */ - de?: Intercom.ArticleContent; + de?: Intercom.ArticleContent | undefined; /** The content of the article in Greek */ - el?: Intercom.ArticleContent; + el?: Intercom.ArticleContent | undefined; /** The content of the article in English */ - en?: Intercom.ArticleContent; + en?: Intercom.ArticleContent | undefined; /** The content of the article in Spanish */ - es?: Intercom.ArticleContent; + es?: Intercom.ArticleContent | undefined; /** The content of the article in Estonian */ - et?: Intercom.ArticleContent; + et?: Intercom.ArticleContent | undefined; /** The content of the article in Finnish */ - fi?: Intercom.ArticleContent; + fi?: Intercom.ArticleContent | undefined; /** The content of the article in French */ - fr?: Intercom.ArticleContent; + fr?: Intercom.ArticleContent | undefined; /** The content of the article in Hebrew */ - he?: Intercom.ArticleContent; + he?: Intercom.ArticleContent | undefined; /** The content of the article in Croatian */ - hr?: Intercom.ArticleContent; + hr?: Intercom.ArticleContent | undefined; /** The content of the article in Hungarian */ - hu?: Intercom.ArticleContent; + hu?: Intercom.ArticleContent | undefined; /** The content of the article in Indonesian */ - id?: Intercom.ArticleContent; + id?: Intercom.ArticleContent | undefined; /** The content of the article in Italian */ - it?: Intercom.ArticleContent; + it?: Intercom.ArticleContent | undefined; /** The content of the article in Japanese */ - ja?: Intercom.ArticleContent; + ja?: Intercom.ArticleContent | undefined; /** The content of the article in Korean */ - ko?: Intercom.ArticleContent; + ko?: Intercom.ArticleContent | undefined; /** The content of the article in Lithuanian */ - lt?: Intercom.ArticleContent; + lt?: Intercom.ArticleContent | undefined; /** The content of the article in Latvian */ - lv?: Intercom.ArticleContent; + lv?: Intercom.ArticleContent | undefined; /** The content of the article in Mongolian */ - mn?: Intercom.ArticleContent; + mn?: Intercom.ArticleContent | undefined; /** The content of the article in Norwegian */ - nb?: Intercom.ArticleContent; + nb?: Intercom.ArticleContent | undefined; /** The content of the article in Dutch */ - nl?: Intercom.ArticleContent; + nl?: Intercom.ArticleContent | undefined; /** The content of the article in Polish */ - pl?: Intercom.ArticleContent; + pl?: Intercom.ArticleContent | undefined; /** The content of the article in Portuguese (Portugal) */ - pt?: Intercom.ArticleContent; + pt?: Intercom.ArticleContent | undefined; /** The content of the article in Romanian */ - ro?: Intercom.ArticleContent; + ro?: Intercom.ArticleContent | undefined; /** The content of the article in Russian */ - ru?: Intercom.ArticleContent; + ru?: Intercom.ArticleContent | undefined; /** The content of the article in Slovenian */ - sl?: Intercom.ArticleContent; + sl?: Intercom.ArticleContent | undefined; /** The content of the article in Serbian */ - sr?: Intercom.ArticleContent; + sr?: Intercom.ArticleContent | undefined; /** The content of the article in Swedish */ - sv?: Intercom.ArticleContent; + sv?: Intercom.ArticleContent | undefined; /** The content of the article in Turkish */ - tr?: Intercom.ArticleContent; + tr?: Intercom.ArticleContent | undefined; /** The content of the article in Vietnamese */ - vi?: Intercom.ArticleContent; + vi?: Intercom.ArticleContent | undefined; /** The content of the article in Portuguese (Brazil) */ - "pt-BR"?: Intercom.ArticleContent; + "pt-BR"?: Intercom.ArticleContent | undefined; /** The content of the article in Chinese (China) */ - "zh-CN"?: Intercom.ArticleContent; + "zh-CN"?: Intercom.ArticleContent | undefined; /** The content of the article in Chinese (Taiwan) */ - "zh-TW"?: Intercom.ArticleContent; + "zh-TW"?: Intercom.ArticleContent | undefined; } diff --git a/src/api/types/AssignConversationRequest.ts b/src/api/types/AssignConversationRequest.ts index 0e2e8ba8..f41ad1dd 100644 --- a/src/api/types/AssignConversationRequest.ts +++ b/src/api/types/AssignConversationRequest.ts @@ -10,7 +10,7 @@ export interface AssignConversationRequest { /** The `id` of the `admin` or `team` which will be assigned the conversation. A conversation can be assigned both an admin and a team.\nSet `0` if you want this assign to no admin or team (ie. Unassigned). */ assignee_id: string; /** Optionally you can send a response in the conversation when it is assigned. */ - body?: string; + body?: string | undefined; } export namespace AssignConversationRequest { diff --git a/src/api/types/AwayStatusReason.ts b/src/api/types/AwayStatusReason.ts index 01eaf720..4faa7455 100644 --- a/src/api/types/AwayStatusReason.ts +++ b/src/api/types/AwayStatusReason.ts @@ -1,19 +1,19 @@ // This file was auto-generated by Fern from our API Definition. export interface AwayStatusReason { - type?: string; + type?: string | undefined; /** The unique identifier for the away status reason */ - id?: string; + id?: string | undefined; /** The display text for the away status reason */ - label?: string; + label?: string | undefined; /** The emoji associated with the status reason */ - emoji?: string; + emoji?: string | undefined; /** The display order of the status reason */ - order?: number; + order?: number | undefined; /** Whether the status reason has been soft deleted */ - deleted?: boolean; + deleted?: boolean | undefined; /** The Unix timestamp when the status reason was created */ - created_at?: number; + created_at?: number | undefined; /** The Unix timestamp when the status reason was last updated */ - updated_at?: number; + updated_at?: number | undefined; } diff --git a/src/api/types/CallList.ts b/src/api/types/CallList.ts index ab4b49a4..d24ee025 100644 --- a/src/api/types/CallList.ts +++ b/src/api/types/CallList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface CallList { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of calls. */ - data?: Intercom.Call[]; + data?: Intercom.Call[] | undefined; /** Total number of items available. */ - total_count?: number; - pages?: Intercom.CursorPages; + total_count?: number | undefined; + pages?: Intercom.CursorPages | undefined; } diff --git a/src/api/types/CloseConversationRequest.ts b/src/api/types/CloseConversationRequest.ts index 0c75f0c3..6330b51e 100644 --- a/src/api/types/CloseConversationRequest.ts +++ b/src/api/types/CloseConversationRequest.ts @@ -8,5 +8,5 @@ export interface CloseConversationRequest { /** The id of the admin who is performing the action. */ admin_id: string; /** Optionally you can leave a message in the conversation to provide additional context to the user and other teammates. */ - body?: string; + body?: string | undefined; } diff --git a/src/api/types/CollectionList.ts b/src/api/types/CollectionList.ts index d2c02975..b99607fd 100644 --- a/src/api/types/CollectionList.ts +++ b/src/api/types/CollectionList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface CollectionList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.OffsetPages; + type?: "list" | undefined; + pages?: Intercom.OffsetPages | undefined; /** A count of the total number of collections. */ - total_count?: number; + total_count?: number | undefined; /** An array of collection objects */ - data?: Intercom.Collection[]; + data?: Intercom.Collection[] | undefined; } diff --git a/src/api/types/CompanyAttachedContacts.ts b/src/api/types/CompanyAttachedContacts.ts index 8725ffd9..37b896e7 100644 --- a/src/api/types/CompanyAttachedContacts.ts +++ b/src/api/types/CompanyAttachedContacts.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface CompanyAttachedContacts { /** The type of object - `list` */ - type?: "list"; + type?: "list" | undefined; /** An array containing Contact Objects */ - data?: Intercom.Contact[]; + data?: Intercom.Contact[] | undefined; /** The total number of contacts */ - total_count?: number; - pages?: Intercom.CursorPages; + total_count?: number | undefined; + pages?: Intercom.CursorPages | undefined; } diff --git a/src/api/types/CompanyAttachedSegments.ts b/src/api/types/CompanyAttachedSegments.ts index aa6941ca..2b50c5bf 100644 --- a/src/api/types/CompanyAttachedSegments.ts +++ b/src/api/types/CompanyAttachedSegments.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface CompanyAttachedSegments { /** The type of object - `list` */ - type?: "list"; + type?: "list" | undefined; /** An array containing Segment Objects */ - data?: Intercom.Segment[]; + data?: Intercom.Segment[] | undefined; } diff --git a/src/api/types/CompanyData.ts b/src/api/types/CompanyData.ts index 29d3a559..1a645a28 100644 --- a/src/api/types/CompanyData.ts +++ b/src/api/types/CompanyData.ts @@ -5,9 +5,9 @@ */ export interface CompanyData { /** The unique identifier for the company which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The type of the object. Always company. */ - type?: "company"; + type?: "company" | undefined; /** The relative URL of the company. */ - url?: string; + url?: string | undefined; } diff --git a/src/api/types/CompanyList.ts b/src/api/types/CompanyList.ts index 34851ae1..36dac646 100644 --- a/src/api/types/CompanyList.ts +++ b/src/api/types/CompanyList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface CompanyList { /** The type of object - `list`. */ - type?: "list"; - pages?: Intercom.OffsetPages; + type?: "list" | undefined; + pages?: Intercom.OffsetPages | undefined; /** The total number of companies. */ - total_count?: number; + total_count?: number | undefined; /** An array containing Company Objects. */ - data?: Intercom.Company[]; + data?: Intercom.Company[] | undefined; } diff --git a/src/api/types/CompanyScroll.ts b/src/api/types/CompanyScroll.ts index 1ba47ea4..01cfc825 100644 --- a/src/api/types/CompanyScroll.ts +++ b/src/api/types/CompanyScroll.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../index.js"; */ export interface CompanyScroll { /** The type of object - `list` */ - type?: "list"; - data?: Intercom.Company[]; - pages?: Intercom.CursorPages; + type?: "list" | undefined; + data?: Intercom.Company[] | undefined; + pages?: Intercom.CursorPages | undefined; /** The total number of companies */ - total_count?: number; + total_count?: number | undefined; /** The scroll parameter to use in the next request to fetch the next page of results. */ - scroll_param?: string; + scroll_param?: string | undefined; } diff --git a/src/api/types/ContactArchived.ts b/src/api/types/ContactArchived.ts index 53e83824..9a28d7f0 100644 --- a/src/api/types/ContactArchived.ts +++ b/src/api/types/ContactArchived.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../index.js"; */ export interface ContactArchived extends Intercom.ContactReference { /** Whether the contact is archived or not. */ - archived?: boolean; + archived?: boolean | undefined; } diff --git a/src/api/types/ContactAttachedCompanies.ts b/src/api/types/ContactAttachedCompanies.ts index 6606054e..62338baa 100644 --- a/src/api/types/ContactAttachedCompanies.ts +++ b/src/api/types/ContactAttachedCompanies.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface ContactAttachedCompanies { /** The type of object */ - type?: "list"; + type?: "list" | undefined; /** An array containing Company Objects */ - companies?: Intercom.Company[]; + companies?: Intercom.Company[] | undefined; /** The total number of companies associated to this contact */ - total_count?: number; - pages?: Intercom.PagesLink; + total_count?: number | undefined; + pages?: Intercom.PagesLink | undefined; } diff --git a/src/api/types/ContactBlocked.ts b/src/api/types/ContactBlocked.ts index 9c85baa7..e6794d83 100644 --- a/src/api/types/ContactBlocked.ts +++ b/src/api/types/ContactBlocked.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../index.js"; */ export interface ContactBlocked extends Intercom.ContactReference { /** Always true. */ - blocked?: boolean; + blocked?: boolean | undefined; } diff --git a/src/api/types/ContactCompanies.ts b/src/api/types/ContactCompanies.ts index 8a3a13b0..454d01e7 100644 --- a/src/api/types/ContactCompanies.ts +++ b/src/api/types/ContactCompanies.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../index.js"; */ export interface ContactCompanies { /** An array of company data objects attached to the contact. */ - data?: Intercom.CompanyData[]; + data?: Intercom.CompanyData[] | undefined; /** Url to get more company resources for this contact */ - url?: string; + url?: string | undefined; /** Integer representing the total number of companies attached to this contact */ - total_count?: number; + total_count?: number | undefined; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more?: boolean; + has_more?: boolean | undefined; } diff --git a/src/api/types/ContactDeleted.ts b/src/api/types/ContactDeleted.ts index 6b047f65..7e86076b 100644 --- a/src/api/types/ContactDeleted.ts +++ b/src/api/types/ContactDeleted.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../index.js"; */ export interface ContactDeleted extends Intercom.ContactReference { /** Whether the contact is deleted or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/types/ContactList.ts b/src/api/types/ContactList.ts index 2fc8ab69..2d884901 100644 --- a/src/api/types/ContactList.ts +++ b/src/api/types/ContactList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface ContactList { /** Always list */ - type?: "list"; + type?: "list" | undefined; /** The list of contact objects */ - data?: Intercom.Contact[]; + data?: Intercom.Contact[] | undefined; /** A count of the total number of objects. */ - total_count?: number; - pages?: Intercom.CursorPages; + total_count?: number | undefined; + pages?: Intercom.CursorPages | undefined; } diff --git a/src/api/types/ContactLocation.ts b/src/api/types/ContactLocation.ts index 73f32530..77c241fd 100644 --- a/src/api/types/ContactLocation.ts +++ b/src/api/types/ContactLocation.ts @@ -5,11 +5,11 @@ */ export interface ContactLocation { /** Always location */ - type?: string; + type?: string | undefined; /** The country that the contact is located in */ - country?: string; + country?: string | undefined; /** The overal region that the contact is located in */ - region?: string; + region?: string | undefined; /** The city that the contact is located in */ - city?: string; + city?: string | undefined; } diff --git a/src/api/types/ContactNotes.ts b/src/api/types/ContactNotes.ts index 77a34b6f..285eea60 100644 --- a/src/api/types/ContactNotes.ts +++ b/src/api/types/ContactNotes.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../index.js"; */ export interface ContactNotes { /** This object represents the notes attached to a contact. */ - data?: Intercom.AddressableList[]; + data?: Intercom.AddressableList[] | undefined; /** Url to get more company resources for this contact */ - url?: string; + url?: string | undefined; /** Int representing the total number of companyies attached to this contact */ - total_count?: number; + total_count?: number | undefined; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more?: boolean; + has_more?: boolean | undefined; } diff --git a/src/api/types/ContactReference.ts b/src/api/types/ContactReference.ts index 6ff6080e..8ce949a7 100644 --- a/src/api/types/ContactReference.ts +++ b/src/api/types/ContactReference.ts @@ -5,9 +5,9 @@ */ export interface ContactReference { /** always contact */ - type?: "contact"; + type?: "contact" | undefined; /** The unique identifier for the contact which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The unique identifier for the contact which is provided by the Client. */ - external_id?: string; + external_id?: string | undefined; } diff --git a/src/api/types/ContactReplyBaseRequest.ts b/src/api/types/ContactReplyBaseRequest.ts index e6ebd102..cb7c6c49 100644 --- a/src/api/types/ContactReplyBaseRequest.ts +++ b/src/api/types/ContactReplyBaseRequest.ts @@ -6,11 +6,11 @@ export interface ContactReplyBaseRequest { /** The text body of the comment. */ body: string; /** The time the reply was created. If not provided, the current time will be used. */ - created_at?: number; + created_at?: number | undefined; /** A list of image URLs that will be added as attachments. You can include up to 10 URLs. */ - attachment_urls?: string[]; + attachment_urls?: string[] | undefined; /** The quick reply selection the contact wishes to respond with. These map to buttons displayed in the Messenger UI if sent by a bot, or the reply options sent by an Admin via the API. */ - reply_options?: ContactReplyBaseRequest.ReplyOptions.Item[]; + reply_options?: ContactReplyBaseRequest.ReplyOptions.Item[] | undefined; } export namespace ContactReplyBaseRequest { diff --git a/src/api/types/ContactReplyEmailRequest.ts b/src/api/types/ContactReplyEmailRequest.ts index 3af33d96..d6a8a7e7 100644 --- a/src/api/types/ContactReplyEmailRequest.ts +++ b/src/api/types/ContactReplyEmailRequest.ts @@ -9,5 +9,5 @@ export interface ContactReplyEmailRequest extends Intercom.ContactReplyBaseReque /** The email you have defined for the user. */ email: string; /** A list of files that will be added as attachments. */ - attachment_files?: Intercom.ConversationAttachmentFiles[]; + attachment_files?: Intercom.ConversationAttachmentFiles[] | undefined; } diff --git a/src/api/types/ContactReplyIntercomUserIdRequest.ts b/src/api/types/ContactReplyIntercomUserIdRequest.ts index 4a3b3f1b..ec4e685c 100644 --- a/src/api/types/ContactReplyIntercomUserIdRequest.ts +++ b/src/api/types/ContactReplyIntercomUserIdRequest.ts @@ -9,5 +9,5 @@ export interface ContactReplyIntercomUserIdRequest extends Intercom.ContactReply /** The identifier for the contact as given by Intercom. */ intercom_user_id: string; /** A list of files that will be added as attachments. */ - attachment_files?: Intercom.ConversationAttachmentFiles[]; + attachment_files?: Intercom.ConversationAttachmentFiles[] | undefined; } diff --git a/src/api/types/ContactReplyUserIdRequest.ts b/src/api/types/ContactReplyUserIdRequest.ts index c043f3cc..7a01fcc8 100644 --- a/src/api/types/ContactReplyUserIdRequest.ts +++ b/src/api/types/ContactReplyUserIdRequest.ts @@ -9,5 +9,5 @@ export interface ContactReplyUserIdRequest extends Intercom.ContactReplyBaseRequ /** The external_id you have defined for the contact. */ user_id: string; /** A list of files that will be added as attachments. You can include up to 10 files. */ - attachment_files?: Intercom.ConversationAttachmentFiles[]; + attachment_files?: Intercom.ConversationAttachmentFiles[] | undefined; } diff --git a/src/api/types/ContactSegments.ts b/src/api/types/ContactSegments.ts index 5099c19d..e724a0f2 100644 --- a/src/api/types/ContactSegments.ts +++ b/src/api/types/ContactSegments.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface ContactSegments { /** The type of the object */ - type?: "list"; + type?: "list" | undefined; /** Segment objects associated with the contact. */ - data?: Intercom.Segment[]; + data?: Intercom.Segment[] | undefined; } diff --git a/src/api/types/ContactSocialProfiles.ts b/src/api/types/ContactSocialProfiles.ts index c61e7c62..68e52a2c 100644 --- a/src/api/types/ContactSocialProfiles.ts +++ b/src/api/types/ContactSocialProfiles.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../index.js"; */ export interface ContactSocialProfiles { /** A list of social profiles objects associated with the contact. */ - data?: Intercom.SocialProfile[]; + data?: Intercom.SocialProfile[] | undefined; } diff --git a/src/api/types/ContactSubscriptionTypes.ts b/src/api/types/ContactSubscriptionTypes.ts index 358f4604..5682e302 100644 --- a/src/api/types/ContactSubscriptionTypes.ts +++ b/src/api/types/ContactSubscriptionTypes.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../index.js"; */ export interface ContactSubscriptionTypes { /** This object represents the subscriptions attached to a contact. */ - data?: Intercom.AddressableList[]; + data?: Intercom.AddressableList[] | undefined; /** Url to get more subscription type resources for this contact */ - url?: string; + url?: string | undefined; /** Int representing the total number of subscription types attached to this contact */ - total_count?: number; + total_count?: number | undefined; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more?: boolean; + has_more?: boolean | undefined; } diff --git a/src/api/types/ContactTags.ts b/src/api/types/ContactTags.ts index 90b8cc0f..def9ef16 100644 --- a/src/api/types/ContactTags.ts +++ b/src/api/types/ContactTags.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../index.js"; */ export interface ContactTags { /** This object represents the tags attached to a contact. */ - data?: Intercom.AddressableList[]; + data?: Intercom.AddressableList[] | undefined; /** url to get more tag resources for this contact */ - url?: string; + url?: string | undefined; /** Int representing the total number of tags attached to this contact */ - total_count?: number; + total_count?: number | undefined; /** Whether there's more Addressable Objects to be viewed. If true, use the url to view all */ - has_more?: boolean; + has_more?: boolean | undefined; } diff --git a/src/api/types/ContactUnarchived.ts b/src/api/types/ContactUnarchived.ts index 5c84ff30..23b58d93 100644 --- a/src/api/types/ContactUnarchived.ts +++ b/src/api/types/ContactUnarchived.ts @@ -7,5 +7,5 @@ import type * as Intercom from "../index.js"; */ export interface ContactUnarchived extends Intercom.ContactReference { /** Whether the contact is archived or not. */ - archived?: boolean; + archived?: boolean | undefined; } diff --git a/src/api/types/ContentSourcesList.ts b/src/api/types/ContentSourcesList.ts index 4af840d0..c483c6e5 100644 --- a/src/api/types/ContentSourcesList.ts +++ b/src/api/types/ContentSourcesList.ts @@ -3,9 +3,9 @@ import type * as Intercom from "../index.js"; export interface ContentSourcesList { - type?: "content_source.list"; + type?: "content_source.list" | undefined; /** The total number of content sources used by AI Agent in the conversation. */ - total_count?: number; + total_count?: number | undefined; /** The content sources used by AI Agent in the conversation. */ - content_sources?: Intercom.ContentSource[]; + content_sources?: Intercom.ContentSource[] | undefined; } diff --git a/src/api/types/ConversationAttachmentFiles.ts b/src/api/types/ConversationAttachmentFiles.ts index f1a0b3e5..db43e27a 100644 --- a/src/api/types/ConversationAttachmentFiles.ts +++ b/src/api/types/ConversationAttachmentFiles.ts @@ -5,9 +5,9 @@ */ export interface ConversationAttachmentFiles { /** The content type of the file */ - content_type?: string; + content_type?: string | undefined; /** The base64 encoded file data. */ - data?: string; + data?: string | undefined; /** The name of the file. */ - name?: string; + name?: string | undefined; } diff --git a/src/api/types/ConversationAttributeUpdatedByAdmin.ts b/src/api/types/ConversationAttributeUpdatedByAdmin.ts index b44c2202..945fd020 100644 --- a/src/api/types/ConversationAttributeUpdatedByAdmin.ts +++ b/src/api/types/ConversationAttributeUpdatedByAdmin.ts @@ -4,18 +4,18 @@ * Contains details about Custom Data Attributes (CDAs) that were modified by an admin (operator) for conversation part type conversation_attribute_updated_by_admin. */ export interface ConversationAttributeUpdatedByAdmin { - attribute?: ConversationAttributeUpdatedByAdmin.Attribute; - value?: ConversationAttributeUpdatedByAdmin.Value; + attribute?: ConversationAttributeUpdatedByAdmin.Attribute | undefined; + value?: ConversationAttributeUpdatedByAdmin.Value | undefined; } export namespace ConversationAttributeUpdatedByAdmin { export interface Attribute { /** Name of the CDA updated */ - name?: string; + name?: string | undefined; } export interface Value { /** Value of the CDA updated */ - name?: string; + name?: string | undefined; } } diff --git a/src/api/types/ConversationAttributeUpdatedByWorkflow.ts b/src/api/types/ConversationAttributeUpdatedByWorkflow.ts index e9e75f32..99bf143a 100644 --- a/src/api/types/ConversationAttributeUpdatedByWorkflow.ts +++ b/src/api/types/ConversationAttributeUpdatedByWorkflow.ts @@ -4,24 +4,24 @@ * Contains details about the workflow that was triggered and any Custom Data Attributes (CDAs) that were modified during the workflow execution for conversation part type conversation_attribute_updated_by_workflow. */ export interface ConversationAttributeUpdatedByWorkflow { - workflow?: ConversationAttributeUpdatedByWorkflow.Workflow; - attribute?: ConversationAttributeUpdatedByWorkflow.Attribute; - value?: ConversationAttributeUpdatedByWorkflow.Value; + workflow?: ConversationAttributeUpdatedByWorkflow.Workflow | undefined; + attribute?: ConversationAttributeUpdatedByWorkflow.Attribute | undefined; + value?: ConversationAttributeUpdatedByWorkflow.Value | undefined; } export namespace ConversationAttributeUpdatedByWorkflow { export interface Workflow { /** Name of the workflow */ - name?: string; + name?: string | undefined; } export interface Attribute { /** Name of the CDA updated */ - name?: string; + name?: string | undefined; } export interface Value { /** Value of the CDA updated */ - name?: string; + name?: string | undefined; } } diff --git a/src/api/types/ConversationContacts.ts b/src/api/types/ConversationContacts.ts index 860cd318..9713e789 100644 --- a/src/api/types/ConversationContacts.ts +++ b/src/api/types/ConversationContacts.ts @@ -6,8 +6,7 @@ import type * as Intercom from "../index.js"; * The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature. */ export interface ConversationContacts { - /** */ - type?: "contact.list"; + type?: "contact.list" | undefined; /** The list of contacts (users or leads) involved in this conversation. This will only contain one customer unless more were added via the group conversation feature. */ - contacts?: Intercom.ContactReference[]; + contacts?: Intercom.ContactReference[] | undefined; } diff --git a/src/api/types/ConversationDeleted.ts b/src/api/types/ConversationDeleted.ts index e61823b9..fb49ade5 100644 --- a/src/api/types/ConversationDeleted.ts +++ b/src/api/types/ConversationDeleted.ts @@ -5,9 +5,9 @@ */ export interface ConversationDeleted { /** The unique identifier for the conversation. */ - id?: string; + id?: string | undefined; /** always conversation */ - object?: "conversation"; + object?: "conversation" | undefined; /** Whether the conversation is deleted or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/types/ConversationFirstContactReply.ts b/src/api/types/ConversationFirstContactReply.ts index 2085bd1e..f0610a31 100644 --- a/src/api/types/ConversationFirstContactReply.ts +++ b/src/api/types/ConversationFirstContactReply.ts @@ -4,10 +4,7 @@ * An object containing information on the first users message. For a contact initiated message this will represent the users original message. */ export interface ConversationFirstContactReply { - /** */ - created_at?: number; - /** */ - type?: string; - /** */ - url?: string; + created_at?: number | undefined; + type?: string | undefined; + url?: string | undefined; } diff --git a/src/api/types/ConversationList.ts b/src/api/types/ConversationList.ts index 4d0c74f3..0560a839 100644 --- a/src/api/types/ConversationList.ts +++ b/src/api/types/ConversationList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface ConversationList { /** Always conversation.list */ - type?: "conversation.list"; + type?: "conversation.list" | undefined; /** The list of conversation objects */ - conversations?: Intercom.Conversation[]; + conversations?: Intercom.Conversation[] | undefined; /** A count of the total number of objects. */ - total_count?: number; - pages?: Intercom.CursorPages; + total_count?: number | undefined; + pages?: Intercom.CursorPages | undefined; } diff --git a/src/api/types/ConversationPart.ts b/src/api/types/ConversationPart.ts index 2182ec66..be724045 100644 --- a/src/api/types/ConversationPart.ts +++ b/src/api/types/ConversationPart.ts @@ -7,37 +7,37 @@ import type * as Intercom from "../index.js"; */ export interface ConversationPart { /** Always conversation_part */ - type?: string; + type?: string | undefined; /** The id representing the conversation part. */ - id?: string; + id?: string | undefined; /** The type of conversation part. */ - part_type?: string; + part_type?: string | undefined; /** The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured. */ - body?: string; + body?: string | undefined; /** The time the conversation part was created. */ - created_at?: number; + created_at?: number | undefined; /** The last time the conversation part was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The time the user was notified with the conversation part. */ - notified_at?: number; + notified_at?: number | undefined; /** The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.) */ - assigned_to?: Intercom.Reference; - author?: Intercom.ConversationPartAuthor; + assigned_to?: Intercom.Reference | undefined; + author?: Intercom.ConversationPartAuthor | undefined; /** A list of attachments for the part. */ - attachments?: Intercom.PartAttachment[]; + attachments?: Intercom.PartAttachment[] | undefined; /** The external id of the conversation part */ - external_id?: string; + external_id?: string | undefined; /** Whether or not the conversation part has been redacted. */ - redacted?: boolean; - email_message_metadata?: Intercom.EmailMessageMetadata; - metadata?: Intercom.ConversationPartMetadata; + redacted?: boolean | undefined; + email_message_metadata?: Intercom.EmailMessageMetadata | undefined; + metadata?: Intercom.ConversationPartMetadata | undefined; /** Indicates the current state of conversation when the conversation part was created. */ - state?: ConversationPart.State; + state?: ConversationPart.State | undefined; /** A list of tags objects associated with the conversation part. */ - tags?: Intercom.TagBasic[]; - event_details?: Intercom.EventDetails; + tags?: Intercom.TagBasic[] | undefined; + event_details?: Intercom.EventDetails | undefined; /** The app package code if this part was created via API. null if the part was not created via API. */ - app_package_code?: string; + app_package_code?: string | undefined; } export namespace ConversationPart { diff --git a/src/api/types/ConversationPartAuthor.ts b/src/api/types/ConversationPartAuthor.ts index 3a17d751..9d3a01eb 100644 --- a/src/api/types/ConversationPartAuthor.ts +++ b/src/api/types/ConversationPartAuthor.ts @@ -5,15 +5,15 @@ */ export interface ConversationPartAuthor { /** The type of the author */ - type?: string; + type?: string | undefined; /** The id of the author */ - id?: string; + id?: string | undefined; /** The name of the author */ - name?: string; + name?: string | undefined; /** The email of the author */ - email?: string; + email?: string | undefined; /** If this conversation part was sent by the AI Agent */ - from_ai_agent?: boolean; + from_ai_agent?: boolean | undefined; /** If this conversation part body was generated by the AI Agent */ - is_ai_answer?: boolean; + is_ai_answer?: boolean | undefined; } diff --git a/src/api/types/ConversationPartMetadata.ts b/src/api/types/ConversationPartMetadata.ts index 34c17f40..e9303a5a 100644 --- a/src/api/types/ConversationPartMetadata.ts +++ b/src/api/types/ConversationPartMetadata.ts @@ -7,9 +7,9 @@ import type * as Intercom from "../index.js"; */ export interface ConversationPartMetadata { /** The quick reply options sent by the Admin or bot, presented in this conversation part. */ - quick_reply_options?: ConversationPartMetadata.QuickReplyOptions.Item[]; + quick_reply_options?: ConversationPartMetadata.QuickReplyOptions.Item[] | undefined; /** The unique identifier for the quick reply option that was clicked by the end user. */ - quick_reply_uuid?: string; + quick_reply_uuid?: string | undefined; } export namespace ConversationPartMetadata { @@ -18,7 +18,7 @@ export namespace ConversationPartMetadata { export namespace QuickReplyOptions { export interface Item extends Intercom.QuickReplyOption { /** The translations for the quick reply option. */ - translations?: Record; + translations?: Record | undefined; } } } diff --git a/src/api/types/ConversationParts.ts b/src/api/types/ConversationParts.ts index ba6730f6..6f5ebdf3 100644 --- a/src/api/types/ConversationParts.ts +++ b/src/api/types/ConversationParts.ts @@ -6,10 +6,8 @@ import type * as Intercom from "../index.js"; * A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts. */ export interface ConversationParts { - /** */ - type?: "conversation_part.list"; + type?: "conversation_part.list" | undefined; /** A list of Conversation Part objects for each part message in the conversation. This is only returned when Retrieving a Conversation, and ignored when Listing all Conversations. There is a limit of 500 parts. */ - conversation_parts?: Intercom.ConversationPart[]; - /** */ - total_count?: number; + conversation_parts?: Intercom.ConversationPart[] | undefined; + total_count?: number | undefined; } diff --git a/src/api/types/ConversationRating.ts b/src/api/types/ConversationRating.ts index 1ba83dbb..ca78c233 100644 --- a/src/api/types/ConversationRating.ts +++ b/src/api/types/ConversationRating.ts @@ -7,13 +7,13 @@ import type * as Intercom from "../index.js"; */ export interface ConversationRating { /** The rating, between 1 and 5, for the conversation. */ - rating?: number; + rating?: number | undefined; /** An optional field to add a remark to correspond to the number rating */ - remark?: string; + remark?: string | undefined; /** The time the rating was requested in the conversation being rated. */ - created_at?: number; + created_at?: number | undefined; /** The time the rating was last updated. */ - updated_at?: number; - contact?: Intercom.ContactReference; - teammate?: Intercom.Reference; + updated_at?: number | undefined; + contact?: Intercom.ContactReference | undefined; + teammate?: Intercom.Reference | undefined; } diff --git a/src/api/types/ConversationResponseTime.ts b/src/api/types/ConversationResponseTime.ts index 8c503679..3cd82fbb 100644 --- a/src/api/types/ConversationResponseTime.ts +++ b/src/api/types/ConversationResponseTime.ts @@ -5,9 +5,9 @@ */ export interface ConversationResponseTime { /** Id of the assigned team. */ - team_id?: number; + team_id?: number | undefined; /** Name of the assigned Team, null if team does not exist, Unassigned if no team is assigned. */ - team_name?: string; + team_name?: string | undefined; /** First response time of assigned team in seconds. */ - response_time?: number; + response_time?: number | undefined; } diff --git a/src/api/types/ConversationSource.ts b/src/api/types/ConversationSource.ts index 960f667c..cfe4db5f 100644 --- a/src/api/types/ConversationSource.ts +++ b/src/api/types/ConversationSource.ts @@ -7,22 +7,22 @@ import type * as Intercom from "../index.js"; */ export interface ConversationSource { /** This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp. */ - type?: ConversationSource.Type; + type?: ConversationSource.Type | undefined; /** The id representing the message. */ - id?: string; + id?: string | undefined; /** The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email). */ - delivered_as?: string; + delivered_as?: string | undefined; /** Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured. */ - subject?: string; + subject?: string | undefined; /** The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured. */ - body?: string; - author?: Intercom.ConversationPartAuthor; + body?: string | undefined; + author?: Intercom.ConversationPartAuthor | undefined; /** A list of attachments for the part. */ - attachments?: Intercom.PartAttachment[]; + attachments?: Intercom.PartAttachment[] | undefined; /** The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank. */ - url?: string; + url?: string | undefined; /** Whether or not the source message has been redacted. Only applicable for contact initiated messages. */ - redacted?: boolean; + redacted?: boolean | undefined; } export namespace ConversationSource { diff --git a/src/api/types/ConversationStatistics.ts b/src/api/types/ConversationStatistics.ts index 999c99f5..afd0c45a 100644 --- a/src/api/types/ConversationStatistics.ts +++ b/src/api/types/ConversationStatistics.ts @@ -6,50 +6,49 @@ import type * as Intercom from "../index.js"; * A Statistics object containing all information required for reporting, with timestamps and calculated metrics. */ export interface ConversationStatistics { - /** */ - type?: string; + type?: string | undefined; /** Duration until last assignment before first admin reply. In seconds. */ - time_to_assignment?: number; + time_to_assignment?: number | undefined; /** Duration until first admin reply. Subtracts out of business hours. In seconds. */ - time_to_admin_reply?: number; + time_to_admin_reply?: number | undefined; /** Duration until conversation was closed first time. Subtracts out of business hours. In seconds. */ - time_to_first_close?: number; + time_to_first_close?: number | undefined; /** Duration until conversation was closed last time. Subtracts out of business hours. In seconds. */ - time_to_last_close?: number; + time_to_last_close?: number | undefined; /** Median based on all admin replies after a contact reply. Subtracts out of business hours. In seconds. */ - median_time_to_reply?: number; + median_time_to_reply?: number | undefined; /** Time of first text conversation part from a contact. */ - first_contact_reply_at?: number; + first_contact_reply_at?: number | undefined; /** Time of first assignment after first_contact_reply_at. */ - first_assignment_at?: number; + first_assignment_at?: number | undefined; /** Time of first admin reply after first_contact_reply_at. */ - first_admin_reply_at?: number; + first_admin_reply_at?: number | undefined; /** Time of first close after first_contact_reply_at. */ - first_close_at?: number; + first_close_at?: number | undefined; /** Time of last assignment after first_contact_reply_at. */ - last_assignment_at?: number; + last_assignment_at?: number | undefined; /** Time of first admin reply since most recent assignment. */ - last_assignment_admin_reply_at?: number; + last_assignment_admin_reply_at?: number | undefined; /** Time of the last conversation part from a contact. */ - last_contact_reply_at?: number; + last_contact_reply_at?: number | undefined; /** Time of the last conversation part from an admin. */ - last_admin_reply_at?: number; + last_admin_reply_at?: number | undefined; /** Time of the last conversation close. */ - last_close_at?: number; + last_close_at?: number | undefined; /** The last admin who closed the conversation. Returns a reference to an Admin object. */ - last_closed_by_id?: string; + last_closed_by_id?: string | undefined; /** Number of reopens after first_contact_reply_at. */ - count_reopens?: number; + count_reopens?: number | undefined; /** Number of assignments after first_contact_reply_at. */ - count_assignments?: number; + count_assignments?: number | undefined; /** Total number of conversation parts. */ - count_conversation_parts?: number; + count_conversation_parts?: number | undefined; /** An array of conversation response time objects */ - assigned_team_first_response_time_by_team?: Intercom.ConversationResponseTime[]; + assigned_team_first_response_time_by_team?: Intercom.ConversationResponseTime[] | undefined; /** An array of conversation response time objects within office hours */ - assigned_team_first_response_time_in_office_hours?: Intercom.ConversationResponseTime[]; + assigned_team_first_response_time_in_office_hours?: Intercom.ConversationResponseTime[] | undefined; /** Time from conversation assignment to conversation close in seconds. */ - handling_time?: number; + handling_time?: number | undefined; /** Adjusted handling time for conversation in seconds. This is the active handling time excluding idle periods when teammates are not actively working on the conversation. */ - adjusted_handling_time?: number; + adjusted_handling_time?: number | undefined; } diff --git a/src/api/types/CreateArticleRequest.ts b/src/api/types/CreateArticleRequest.ts index 432c43aa..1097f93b 100644 --- a/src/api/types/CreateArticleRequest.ts +++ b/src/api/types/CreateArticleRequest.ts @@ -9,18 +9,18 @@ export interface CreateArticleRequest { /** The title of the article.For multilingual articles, this will be the title of the default language's content. */ title: string; /** The description of the article. For multilingual articles, this will be the description of the default language's content. */ - description?: string; + description?: string | undefined; /** The content of the article. For multilingual articles, this will be the body of the default language's content. */ - body?: string; + body?: string | undefined; /** The id of the author of the article. For multilingual articles, this will be the id of the author of the default language's content. Must be a teammate on the help center's workspace. */ author_id: number; /** Whether the article will be `published` or will be a `draft`. Defaults to draft. For multilingual articles, this will be the state of the default language's content. */ - state?: CreateArticleRequest.State; + state?: CreateArticleRequest.State | undefined; /** The id of the article's parent collection or section. An article without this field stands alone. */ - parent_id?: number; + parent_id?: number | undefined; /** The type of parent, which can either be a `collection` or `section`. */ - parent_type?: CreateArticleRequest.ParentType; - translated_content?: Intercom.ArticleTranslatedContent; + parent_type?: CreateArticleRequest.ParentType | undefined; + translated_content?: Intercom.ArticleTranslatedContent | undefined; } export namespace CreateArticleRequest { diff --git a/src/api/types/CreateDataAttributeRequest.ts b/src/api/types/CreateDataAttributeRequest.ts index e2abd5d2..e57537cd 100644 --- a/src/api/types/CreateDataAttributeRequest.ts +++ b/src/api/types/CreateDataAttributeRequest.ts @@ -1,8 +1,5 @@ // This file was auto-generated by Fern from our API Definition. -/** - * - */ export type CreateDataAttributeRequest = | { data_type?: "options" | undefined; diff --git a/src/api/types/CreateDataEventRequest.ts b/src/api/types/CreateDataEventRequest.ts index b0502eab..d0534132 100644 --- a/src/api/types/CreateDataEventRequest.ts +++ b/src/api/types/CreateDataEventRequest.ts @@ -1,8 +1,5 @@ // This file was auto-generated by Fern from our API Definition. -/** - * - */ export type CreateDataEventRequest = | { id: string; diff --git a/src/api/types/CreateInternalArticleRequest.ts b/src/api/types/CreateInternalArticleRequest.ts index f971e918..0c226774 100644 --- a/src/api/types/CreateInternalArticleRequest.ts +++ b/src/api/types/CreateInternalArticleRequest.ts @@ -7,7 +7,7 @@ export interface CreateInternalArticleRequest { /** The title of the article. */ title: string; /** The content of the article. */ - body?: string; + body?: string | undefined; /** The id of the author of the article. */ author_id: number; /** The id of the owner of the article. */ diff --git a/src/api/types/CreateMessageRequest.ts b/src/api/types/CreateMessageRequest.ts index 2e3bc5fb..41f0e30d 100644 --- a/src/api/types/CreateMessageRequest.ts +++ b/src/api/types/CreateMessageRequest.ts @@ -21,9 +21,9 @@ export namespace CreateMessageRequest { /** The sender of the message. If not provided, the default sender will be used. */ to: CreateMessageRequestWithEmail.To; /** The time the message was created. If not provided, the current time will be used. */ - created_at?: number; + created_at?: number | undefined; /** Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided. */ - create_conversation_without_contact_reply?: boolean; + create_conversation_without_contact_reply?: boolean | undefined; } export namespace CreateMessageRequestWithEmail { @@ -60,19 +60,19 @@ export namespace CreateMessageRequest { export interface Inapp { message_type: "inapp"; /** The title of the email. */ - subject?: string; + subject?: string | undefined; /** The content of the message. HTML and plaintext are supported. */ body: string; /** The style of the outgoing message. Possible values `plain` or `personal`. */ - template?: string; + template?: string | undefined; /** The sender of the message. If not provided, the default sender will be used. */ from: CreateMessageRequestWithInapp.From; /** The sender of the message. If not provided, the default sender will be used. */ to: CreateMessageRequestWithInapp.To; /** The time the message was created. If not provided, the current time will be used. */ - created_at?: number; + created_at?: number | undefined; /** Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided. */ - create_conversation_without_contact_reply?: boolean; + create_conversation_without_contact_reply?: boolean | undefined; } export namespace CreateMessageRequestWithInapp { diff --git a/src/api/types/CreateOrUpdateCompanyRequest.ts b/src/api/types/CreateOrUpdateCompanyRequest.ts index 136693c2..00bdf388 100644 --- a/src/api/types/CreateOrUpdateCompanyRequest.ts +++ b/src/api/types/CreateOrUpdateCompanyRequest.ts @@ -5,21 +5,21 @@ */ export interface CreateOrUpdateCompanyRequest { /** The name of the Company */ - name?: string; + name?: string | undefined; /** The company id you have defined for the company. Can't be updated */ - company_id?: string; + company_id?: string | undefined; /** The name of the plan you have associated with the company. */ - plan?: string; + plan?: string | undefined; /** The number of employees in this company. */ - size?: number; + size?: number | undefined; /** The URL for this company's website. Please note that the value specified here is not validated. Accepts any string. */ - website?: string; + website?: string | undefined; /** The industry that this company operates in. */ - industry?: string; + industry?: string | undefined; /** A hash of key/value pairs containing any other data about the company you want Intercom to store. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; /** The time the company was created by you. */ - remote_created_at?: number; + remote_created_at?: number | undefined; /** How much revenue the company generates for your business. Note that this will truncate floats. i.e. it only allow for whole integers, 155.98 will be truncated to 155. Note that this has an upper limit of 2**31-1 or 2147483647.. */ - monthly_spend?: number; + monthly_spend?: number | undefined; } diff --git a/src/api/types/CreateOrUpdateTagRequest.ts b/src/api/types/CreateOrUpdateTagRequest.ts index 7dfd1b3f..59201c9c 100644 --- a/src/api/types/CreateOrUpdateTagRequest.ts +++ b/src/api/types/CreateOrUpdateTagRequest.ts @@ -7,5 +7,5 @@ export interface CreateOrUpdateTagRequest { /** The name of the tag, which will be created if not found, or the new name for the tag if this is an update request. Names are case insensitive. */ name: string; /** The id of tag to updates. */ - id?: string; + id?: string | undefined; } diff --git a/src/api/types/CreatePhoneSwitchRequest.ts b/src/api/types/CreatePhoneSwitchRequest.ts index aae47b79..61a6974b 100644 --- a/src/api/types/CreatePhoneSwitchRequest.ts +++ b/src/api/types/CreatePhoneSwitchRequest.ts @@ -8,5 +8,5 @@ import type * as Intercom from "../index.js"; export interface CreatePhoneSwitchRequest { /** Phone number in E.164 format, that will receive the SMS to continue the conversation in the Messenger. */ phone: string; - custom_attributes?: Intercom.CustomAttributes; + custom_attributes?: Intercom.CustomAttributes | undefined; } diff --git a/src/api/types/CreateTicketRequestBody.ts b/src/api/types/CreateTicketRequestBody.ts index 9ec9fb5c..125c1338 100644 --- a/src/api/types/CreateTicketRequestBody.ts +++ b/src/api/types/CreateTicketRequestBody.ts @@ -15,12 +15,12 @@ export interface CreateTicketRequestBody { * - conversation | tracker ticket * - customer ticket | tracker ticket */ - conversation_to_link_id?: string; + conversation_to_link_id?: string | undefined; /** The ID of the company that the ticket is associated with. The unique identifier for the company which is given by Intercom */ - company_id?: string; + company_id?: string | undefined; /** The time the ticket was created. If not provided, the current time will be used. */ - created_at?: number; - assignment?: CreateTicketRequestBody.Assignment; + created_at?: number | undefined; + assignment?: CreateTicketRequestBody.Assignment | undefined; } export namespace CreateTicketRequestBody { @@ -41,8 +41,8 @@ export namespace CreateTicketRequestBody { export interface Assignment { /** The ID of the admin to which the ticket is assigned. If not provided, the ticket will be unassigned. */ - admin_assignee_id?: string; + admin_assignee_id?: string | undefined; /** The ID of the team to which the ticket is assigned. If not provided, the ticket will be unassigned. */ - team_assignee_id?: string; + team_assignee_id?: string | undefined; } } diff --git a/src/api/types/CreateTicketTypeRequest.ts b/src/api/types/CreateTicketTypeRequest.ts index eebc72da..a73b0682 100644 --- a/src/api/types/CreateTicketTypeRequest.ts +++ b/src/api/types/CreateTicketTypeRequest.ts @@ -8,13 +8,13 @@ export interface CreateTicketTypeRequest { /** The name of the ticket type. */ name: string; /** The description of the ticket type. */ - description?: string; + description?: string | undefined; /** Category of the Ticket Type. */ - category?: CreateTicketTypeRequest.Category; + category?: CreateTicketTypeRequest.Category | undefined; /** The icon of the ticket type. */ - icon?: string; + icon?: string | undefined; /** Whether the tickets associated with this ticket type are intended for internal use only or will be shared with customers. This is currently a limited attribute. */ - is_internal?: boolean; + is_internal?: boolean | undefined; } export namespace CreateTicketTypeRequest { diff --git a/src/api/types/CursorPages.ts b/src/api/types/CursorPages.ts index 4245c670..e82440eb 100644 --- a/src/api/types/CursorPages.ts +++ b/src/api/types/CursorPages.ts @@ -8,12 +8,12 @@ import type * as Intercom from "../index.js"; */ export interface CursorPages { /** the type of object `pages`. */ - type?: "pages"; + type?: "pages" | undefined; /** The current page */ - page?: number; - next?: Intercom.StartingAfterPaging; + page?: number | undefined; + next?: Intercom.StartingAfterPaging | undefined; /** Number of results per page */ - per_page?: number; + per_page?: number | undefined; /** Total number of pages */ - total_pages?: number; + total_pages?: number | undefined; } diff --git a/src/api/types/CustomActionFinished.ts b/src/api/types/CustomActionFinished.ts index 54471392..d91b32a3 100644 --- a/src/api/types/CustomActionFinished.ts +++ b/src/api/types/CustomActionFinished.ts @@ -4,15 +4,15 @@ * Contains details about final status of the completed action for conversation part type custom_action_finished. */ export interface CustomActionFinished { - action?: CustomActionFinished.Action; + action?: CustomActionFinished.Action | undefined; } export namespace CustomActionFinished { export interface Action { /** Name of the action */ - name?: string; + name?: string | undefined; /** Status of the action */ - result?: Action.Result; + result?: Action.Result | undefined; } export namespace Action { diff --git a/src/api/types/CustomActionStarted.ts b/src/api/types/CustomActionStarted.ts index 18114f6c..fe8d34ea 100644 --- a/src/api/types/CustomActionStarted.ts +++ b/src/api/types/CustomActionStarted.ts @@ -4,12 +4,12 @@ * Contains details about name of the action that was initiated for conversation part type custom_action_started. */ export interface CustomActionStarted { - action?: CustomActionStarted.Action; + action?: CustomActionStarted.Action | undefined; } export namespace CustomActionStarted { export interface Action { /** Name of the action */ - name?: string; + name?: string | undefined; } } diff --git a/src/api/types/CustomChannelContact.ts b/src/api/types/CustomChannelContact.ts index 7d11a83c..04676675 100644 --- a/src/api/types/CustomChannelContact.ts +++ b/src/api/types/CustomChannelContact.ts @@ -6,9 +6,9 @@ export interface CustomChannelContact { /** External identifier for the contact. Intercom will take care of the mapping of your external_id with our internal ones so you don't have to worry about it. */ external_id: string; /** Name of the contact. Required for user type. */ - name?: string; + name?: string | undefined; /** Email address of the contact. Required for user type. */ - email?: string; + email?: string | undefined; } export namespace CustomChannelContact { diff --git a/src/api/types/CustomObjectInstanceDeleted.ts b/src/api/types/CustomObjectInstanceDeleted.ts index 4c14eba9..6cfa0af3 100644 --- a/src/api/types/CustomObjectInstanceDeleted.ts +++ b/src/api/types/CustomObjectInstanceDeleted.ts @@ -5,9 +5,9 @@ */ export interface CustomObjectInstanceDeleted { /** The unique identifier of the Custom Object type that defines the structure of the Custom Object instance. */ - object?: string; + object?: string | undefined; /** The Intercom defined id representing the Custom Object instance. */ - id?: string; + id?: string | undefined; /** Whether the Custom Object instance is deleted or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/types/CustomObjectInstanceList.ts b/src/api/types/CustomObjectInstanceList.ts index f537ed2d..007e013d 100644 --- a/src/api/types/CustomObjectInstanceList.ts +++ b/src/api/types/CustomObjectInstanceList.ts @@ -6,7 +6,7 @@ import type * as Intercom from "../index.js"; * The list of associated custom object instances for a given reference attribute on the parent object. */ export interface CustomObjectInstanceList { - type?: string; + type?: string | undefined; /** The list of associated custom object instances for a given reference attribute on the parent object. */ - instances?: (Intercom.CustomObjectInstance | undefined)[]; + instances?: (Intercom.CustomObjectInstance | undefined)[] | undefined; } diff --git a/src/api/types/DataAttributeList.ts b/src/api/types/DataAttributeList.ts index 6fb01c20..2432af7b 100644 --- a/src/api/types/DataAttributeList.ts +++ b/src/api/types/DataAttributeList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface DataAttributeList { /** The type of the object */ - type?: "list"; + type?: "list" | undefined; /** A list of data attributes */ - data?: Intercom.DataAttribute[]; + data?: Intercom.DataAttribute[] | undefined; } diff --git a/src/api/types/DataEventList.ts b/src/api/types/DataEventList.ts index 2a68082a..1aaec468 100644 --- a/src/api/types/DataEventList.ts +++ b/src/api/types/DataEventList.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../index.js"; */ export interface DataEventList { /** The type of the object */ - type?: "event.list"; + type?: "event.list" | undefined; /** A list of data events */ - events?: Intercom.DataEvent[]; + events?: Intercom.DataEvent[] | undefined; /** Pagination */ - pages?: DataEventList.Pages; + pages?: DataEventList.Pages | undefined; } export namespace DataEventList { @@ -19,7 +19,7 @@ export namespace DataEventList { * Pagination */ export interface Pages { - next?: string; - since?: string; + next?: string | undefined; + since?: string | undefined; } } diff --git a/src/api/types/DataEventSummary.ts b/src/api/types/DataEventSummary.ts index e2791b1f..b2026f10 100644 --- a/src/api/types/DataEventSummary.ts +++ b/src/api/types/DataEventSummary.ts @@ -7,13 +7,13 @@ import type * as Intercom from "../index.js"; */ export interface DataEventSummary { /** The type of the object */ - type?: "event.summary"; + type?: "event.summary" | undefined; /** The email address of the user */ - email?: string; + email?: string | undefined; /** The Intercom user ID of the user */ - intercom_user_id?: string; + intercom_user_id?: string | undefined; /** The user ID of the user */ - user_id?: string; + user_id?: string | undefined; /** A summary of data events */ events: (Intercom.DataEventSummaryItem | undefined)[]; } diff --git a/src/api/types/DataEventSummaryItem.ts b/src/api/types/DataEventSummaryItem.ts index 9f0d9192..3f6b87b4 100644 --- a/src/api/types/DataEventSummaryItem.ts +++ b/src/api/types/DataEventSummaryItem.ts @@ -5,13 +5,13 @@ */ export interface DataEventSummaryItem { /** The name of the event */ - name?: string; + name?: string | undefined; /** The first time the event was sent */ - first?: string; + first?: string | undefined; /** The last time the event was sent */ - last?: string; + last?: string | undefined; /** The number of times the event was sent */ - count?: number; + count?: number | undefined; /** The description of the event */ - description?: string; + description?: string | undefined; } diff --git a/src/api/types/DataExportCsv.ts b/src/api/types/DataExportCsv.ts index 8c268f7e..181d4ecd 100644 --- a/src/api/types/DataExportCsv.ts +++ b/src/api/types/DataExportCsv.ts @@ -5,55 +5,55 @@ */ export interface DataExportCsv { /** The user_id of the user who was sent the message. */ - user_id?: string; + user_id?: string | undefined; /** The external_user_id of the user who was sent the message */ - user_external_id?: string; + user_external_id?: string | undefined; /** The company ID of the user in relation to the message that was sent. Will return -1 if no company is present. */ - company_id?: string; + company_id?: string | undefined; /** The users email who was sent the message. */ - email?: string; + email?: string | undefined; /** The full name of the user receiving the message */ - name?: string; + name?: string | undefined; /** The id of the message. */ - ruleset_id?: string; + ruleset_id?: string | undefined; /** The specific content that was received. In an A/B test each version has its own Content ID. */ - content_id?: string; + content_id?: string | undefined; /** Email, Chat, Post etc. */ - content_type?: string; + content_type?: string | undefined; /** The title of the content you see in your Intercom workspace. */ - content_title?: string; + content_title?: string | undefined; /** As you edit content we record new versions. This ID can help you determine which version of a piece of content that was received. */ - ruleset_version_id?: string; + ruleset_version_id?: string | undefined; /** ID for this receipt. Will be included with any related stats in other files to identify this specific delivery of a message. */ - receipt_id?: string; + receipt_id?: string | undefined; /** Timestamp for when the receipt was recorded. */ - received_at?: number; + received_at?: number | undefined; /** The id of the series that this content is part of. Will return -1 if not part of a series. */ - series_id?: string; + series_id?: string | undefined; /** The title of the series that this content is part of. */ - series_title?: string; + series_title?: string | undefined; /** The id of the series node that this ruleset is associated with. Each block in a series has a corresponding node_id. */ - node_id?: string; + node_id?: string | undefined; /** The first time a user replied to this message if the content was able to receive replies. */ - first_reply?: number; + first_reply?: number | undefined; /** The first time a user completed this message if the content was able to be completed e.g. Tours, Surveys. */ - first_completion?: number; + first_completion?: number | undefined; /** The first time the series this message was a part of was completed by the user. */ - first_series_completion?: number; + first_series_completion?: number | undefined; /** The first time the series this message was a part of was disengaged by the user. */ - first_series_disengagement?: number; + first_series_disengagement?: number | undefined; /** The first time the series this message was a part of was exited by the user. */ - first_series_exit?: number; + first_series_exit?: number | undefined; /** The first time the user met this messages associated goal if one exists. */ - first_goal_success?: number; + first_goal_success?: number | undefined; /** The first time the user opened this message. */ - first_open?: number; + first_open?: number | undefined; /** The first time the series the user clicked on a link within this message. */ - first_click?: number; + first_click?: number | undefined; /** The first time the series the user dismissed this message. */ - first_dismisall?: number; + first_dismisall?: number | undefined; /** The first time the user unsubscribed from this message. */ - first_unsubscribe?: number; + first_unsubscribe?: number | undefined; /** The first time this message hard bounced for this user */ - first_hard_bounce?: number; + first_hard_bounce?: number | undefined; } diff --git a/src/api/types/DeletedArticleObject.ts b/src/api/types/DeletedArticleObject.ts index 5667114c..b4fb28a3 100644 --- a/src/api/types/DeletedArticleObject.ts +++ b/src/api/types/DeletedArticleObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedArticleObject { /** The unique identifier for the article which you provided in the URL. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted. - article */ - object?: "article"; + object?: "article" | undefined; /** Whether the article was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/types/DeletedCollectionObject.ts b/src/api/types/DeletedCollectionObject.ts index 4d03d936..8a34ae0c 100644 --- a/src/api/types/DeletedCollectionObject.ts +++ b/src/api/types/DeletedCollectionObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedCollectionObject { /** The unique identifier for the collection which you provided in the URL. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted. - `collection` */ - object?: "collection"; + object?: "collection" | undefined; /** Whether the collection was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/types/DeletedCompanyObject.ts b/src/api/types/DeletedCompanyObject.ts index b5ee6cf6..9cb69bff 100644 --- a/src/api/types/DeletedCompanyObject.ts +++ b/src/api/types/DeletedCompanyObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedCompanyObject { /** The unique identifier for the company which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted. - `company` */ - object?: "company"; + object?: "company" | undefined; /** Whether the company was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/types/DeletedInternalArticleObject.ts b/src/api/types/DeletedInternalArticleObject.ts index 47d5060b..fec945c6 100644 --- a/src/api/types/DeletedInternalArticleObject.ts +++ b/src/api/types/DeletedInternalArticleObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedInternalArticleObject { /** The unique identifier for the internal article which you provided in the URL. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted. - internal_article */ - object?: "internal_article"; + object?: "internal_article" | undefined; /** Whether the internal article was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/types/DeletedObject.ts b/src/api/types/DeletedObject.ts index a22b393b..7b8ff435 100644 --- a/src/api/types/DeletedObject.ts +++ b/src/api/types/DeletedObject.ts @@ -5,9 +5,9 @@ */ export interface DeletedObject { /** The unique identifier for the news item which you provided in the URL. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted - news-item. */ - object?: "news-item"; + object?: "news-item" | undefined; /** Whether the news item was deleted successfully or not. */ - deleted?: boolean; + deleted?: boolean | undefined; } diff --git a/src/api/types/EmailAddressHeader.ts b/src/api/types/EmailAddressHeader.ts index 7e8d234d..82585c50 100644 --- a/src/api/types/EmailAddressHeader.ts +++ b/src/api/types/EmailAddressHeader.ts @@ -5,9 +5,9 @@ */ export interface EmailAddressHeader { /** The type of email address header */ - type?: string; + type?: string | undefined; /** The email address */ - email_address?: string; + email_address?: string | undefined; /** The name associated with the email address */ - name?: string; + name?: string | undefined; } diff --git a/src/api/types/EmailMessageMetadata.ts b/src/api/types/EmailMessageMetadata.ts index 815571b7..3e4c7019 100644 --- a/src/api/types/EmailMessageMetadata.ts +++ b/src/api/types/EmailMessageMetadata.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface EmailMessageMetadata { /** The subject of the email */ - subject?: string; + subject?: string | undefined; /** A list of an email address headers. */ - email_address_headers?: Intercom.EmailAddressHeader[]; + email_address_headers?: Intercom.EmailAddressHeader[] | undefined; } diff --git a/src/api/types/Error_.ts b/src/api/types/Error_.ts index 5a4a39f0..45ddb119 100644 --- a/src/api/types/Error_.ts +++ b/src/api/types/Error_.ts @@ -6,8 +6,7 @@ export interface Error_ { /** The type is error.list */ type: "error.list"; - /** */ - request_id?: string; + request_id?: string | undefined; /** An array of one or more error objects */ errors: Error_.Errors.Item[]; } @@ -20,9 +19,9 @@ export namespace Error_ { /** A string indicating the kind of error, used to further qualify the HTTP response code */ code: string; /** Optional. Human readable description of the error. */ - message?: string; + message?: string | undefined; /** Optional. Used to identify a particular field or query parameter that was in error. */ - field?: string; + field?: string | undefined; } } } diff --git a/src/api/types/FileAttribute.ts b/src/api/types/FileAttribute.ts index b8fab036..9c306bee 100644 --- a/src/api/types/FileAttribute.ts +++ b/src/api/types/FileAttribute.ts @@ -4,17 +4,17 @@ * The value describing a file upload set for a custom attribute */ export interface FileAttribute { - type?: string; + type?: string | undefined; /** The name of the file */ - name?: string; + name?: string | undefined; /** The url of the file. This is a temporary URL and will expire after 30 minutes. */ - url?: string; + url?: string | undefined; /** The type of file */ - content_type?: string; + content_type?: string | undefined; /** The size of the file in bytes */ - filesize?: number; + filesize?: number | undefined; /** The width of the file in pixels, if applicable */ - width?: number; + width?: number | undefined; /** The height of the file in pixels, if applicable */ - height?: number; + height?: number | undefined; } diff --git a/src/api/types/GroupContent.ts b/src/api/types/GroupContent.ts index 68c5b320..3aa3f5fb 100644 --- a/src/api/types/GroupContent.ts +++ b/src/api/types/GroupContent.ts @@ -5,9 +5,9 @@ */ export interface GroupContent { /** The type of object - `group_content` . */ - type?: "group_content"; + type?: "group_content" | undefined; /** The name of the collection or section. */ - name?: string; + name?: string | undefined; /** The description of the collection. Only available for collections. */ - description?: string; + description?: string | undefined; } diff --git a/src/api/types/GroupTranslatedContent.ts b/src/api/types/GroupTranslatedContent.ts index 51302ff2..c12ac92d 100644 --- a/src/api/types/GroupTranslatedContent.ts +++ b/src/api/types/GroupTranslatedContent.ts @@ -7,79 +7,79 @@ import type * as Intercom from "../index.js"; */ export interface GroupTranslatedContent { /** The type of object - group_translated_content. */ - type?: "group_translated_content"; + type?: "group_translated_content" | undefined; /** The content of the group in Arabic */ - ar?: Intercom.GroupContent; + ar?: Intercom.GroupContent | undefined; /** The content of the group in Bulgarian */ - bg?: Intercom.GroupContent; + bg?: Intercom.GroupContent | undefined; /** The content of the group in Bosnian */ - bs?: Intercom.GroupContent; + bs?: Intercom.GroupContent | undefined; /** The content of the group in Catalan */ - ca?: Intercom.GroupContent; + ca?: Intercom.GroupContent | undefined; /** The content of the group in Czech */ - cs?: Intercom.GroupContent; + cs?: Intercom.GroupContent | undefined; /** The content of the group in Danish */ - da?: Intercom.GroupContent; + da?: Intercom.GroupContent | undefined; /** The content of the group in German */ - de?: Intercom.GroupContent; + de?: Intercom.GroupContent | undefined; /** The content of the group in Greek */ - el?: Intercom.GroupContent; + el?: Intercom.GroupContent | undefined; /** The content of the group in English */ - en?: Intercom.GroupContent; + en?: Intercom.GroupContent | undefined; /** The content of the group in Spanish */ - es?: Intercom.GroupContent; + es?: Intercom.GroupContent | undefined; /** The content of the group in Estonian */ - et?: Intercom.GroupContent; + et?: Intercom.GroupContent | undefined; /** The content of the group in Finnish */ - fi?: Intercom.GroupContent; + fi?: Intercom.GroupContent | undefined; /** The content of the group in French */ - fr?: Intercom.GroupContent; + fr?: Intercom.GroupContent | undefined; /** The content of the group in Hebrew */ - he?: Intercom.GroupContent; + he?: Intercom.GroupContent | undefined; /** The content of the group in Croatian */ - hr?: Intercom.GroupContent; + hr?: Intercom.GroupContent | undefined; /** The content of the group in Hungarian */ - hu?: Intercom.GroupContent; + hu?: Intercom.GroupContent | undefined; /** The content of the group in Indonesian */ - id?: Intercom.GroupContent; + id?: Intercom.GroupContent | undefined; /** The content of the group in Italian */ - it?: Intercom.GroupContent; + it?: Intercom.GroupContent | undefined; /** The content of the group in Japanese */ - ja?: Intercom.GroupContent; + ja?: Intercom.GroupContent | undefined; /** The content of the group in Korean */ - ko?: Intercom.GroupContent; + ko?: Intercom.GroupContent | undefined; /** The content of the group in Lithuanian */ - lt?: Intercom.GroupContent; + lt?: Intercom.GroupContent | undefined; /** The content of the group in Latvian */ - lv?: Intercom.GroupContent; + lv?: Intercom.GroupContent | undefined; /** The content of the group in Mongolian */ - mn?: Intercom.GroupContent; + mn?: Intercom.GroupContent | undefined; /** The content of the group in Norwegian */ - nb?: Intercom.GroupContent; + nb?: Intercom.GroupContent | undefined; /** The content of the group in Dutch */ - nl?: Intercom.GroupContent; + nl?: Intercom.GroupContent | undefined; /** The content of the group in Polish */ - pl?: Intercom.GroupContent; + pl?: Intercom.GroupContent | undefined; /** The content of the group in Portuguese (Portugal) */ - pt?: Intercom.GroupContent; + pt?: Intercom.GroupContent | undefined; /** The content of the group in Romanian */ - ro?: Intercom.GroupContent; + ro?: Intercom.GroupContent | undefined; /** The content of the group in Russian */ - ru?: Intercom.GroupContent; + ru?: Intercom.GroupContent | undefined; /** The content of the group in Slovenian */ - sl?: Intercom.GroupContent; + sl?: Intercom.GroupContent | undefined; /** The content of the group in Serbian */ - sr?: Intercom.GroupContent; + sr?: Intercom.GroupContent | undefined; /** The content of the group in Swedish */ - sv?: Intercom.GroupContent; + sv?: Intercom.GroupContent | undefined; /** The content of the group in Turkish */ - tr?: Intercom.GroupContent; + tr?: Intercom.GroupContent | undefined; /** The content of the group in Vietnamese */ - vi?: Intercom.GroupContent; + vi?: Intercom.GroupContent | undefined; /** The content of the group in Portuguese (Brazil) */ - "pt-BR"?: Intercom.GroupContent; + "pt-BR"?: Intercom.GroupContent | undefined; /** The content of the group in Chinese (China) */ - "zh-CN"?: Intercom.GroupContent; + "zh-CN"?: Intercom.GroupContent | undefined; /** The content of the group in Chinese (Taiwan) */ - "zh-TW"?: Intercom.GroupContent; + "zh-TW"?: Intercom.GroupContent | undefined; } diff --git a/src/api/types/InternalArticleList.ts b/src/api/types/InternalArticleList.ts index 8de68a0a..b54c0f5b 100644 --- a/src/api/types/InternalArticleList.ts +++ b/src/api/types/InternalArticleList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface InternalArticleList { /** The type of the object - `list`. */ - type?: "list"; - pages?: Intercom.CursorPages; + type?: "list" | undefined; + pages?: Intercom.CursorPages | undefined; /** A count of the total number of internal articles. */ - total_count?: number; + total_count?: number | undefined; /** An array of Internal Article objects */ - data?: Intercom.InternalArticleListItem[]; + data?: Intercom.InternalArticleListItem[] | undefined; } diff --git a/src/api/types/IpAllowlist.ts b/src/api/types/IpAllowlist.ts index 27a5b011..93155953 100644 --- a/src/api/types/IpAllowlist.ts +++ b/src/api/types/IpAllowlist.ts @@ -5,14 +5,14 @@ */ export interface IpAllowlist { /** String representing the object's type. Always has the value `ip_allowlist`. */ - type?: string; + type?: string | undefined; /** Whether the IP allowlist is enabled for the workspace. */ - enabled?: boolean; + enabled?: boolean | undefined; /** * List of allowed IP addresses and/or IP ranges in CIDR notation. * Examples: * - Single IP: `192.168.0.1` * - IP range: `192.168.0.1/24` (allows 192.168.0.0 - 192.168.0.255) */ - ip_allowlist?: string[]; + ip_allowlist?: string[] | undefined; } diff --git a/src/api/types/LinkedObject.ts b/src/api/types/LinkedObject.ts index 27fe77b5..85dcbf9d 100644 --- a/src/api/types/LinkedObject.ts +++ b/src/api/types/LinkedObject.ts @@ -5,11 +5,11 @@ */ export interface LinkedObject { /** ticket or conversation */ - type?: LinkedObject.Type; + type?: LinkedObject.Type | undefined; /** The ID of the linked object */ - id?: string; + id?: string | undefined; /** Category of the Linked Ticket Object. */ - category?: LinkedObject.Category; + category?: LinkedObject.Category | undefined; } export namespace LinkedObject { diff --git a/src/api/types/LinkedObjectList.ts b/src/api/types/LinkedObjectList.ts index 3443c217..486905e8 100644 --- a/src/api/types/LinkedObjectList.ts +++ b/src/api/types/LinkedObjectList.ts @@ -7,11 +7,11 @@ import type * as Intercom from "../index.js"; */ export interface LinkedObjectList { /** Always list. */ - type?: "list"; + type?: "list" | undefined; /** The total number of linked objects. */ - total_count?: number; + total_count?: number | undefined; /** Whether or not there are more linked objects than returned. */ - has_more?: boolean; + has_more?: boolean | undefined; /** An array containing the linked conversations and linked tickets. */ - data?: Intercom.LinkedObject[]; + data?: Intercom.LinkedObject[] | undefined; } diff --git a/src/api/types/Metadata.ts b/src/api/types/Metadata.ts index 8d9ca56e..f25fd227 100644 --- a/src/api/types/Metadata.ts +++ b/src/api/types/Metadata.ts @@ -2,4 +2,4 @@ import type * as Intercom from "../index.js"; -export type Metadata = Intercom.unstable.ConversationPartMetadata; +export type Metadata = Intercom.ConversationPartMetadata; diff --git a/src/api/types/MultipleFilterSearchRequest.ts b/src/api/types/MultipleFilterSearchRequest.ts index 400b4119..680bda05 100644 --- a/src/api/types/MultipleFilterSearchRequest.ts +++ b/src/api/types/MultipleFilterSearchRequest.ts @@ -7,8 +7,8 @@ import type * as Intercom from "../index.js"; */ export interface MultipleFilterSearchRequest { /** An operator to allow boolean inspection between multiple fields. */ - operator?: MultipleFilterSearchRequest.Operator; - value?: MultipleFilterSearchRequest.Value; + operator?: MultipleFilterSearchRequest.Operator | undefined; + value?: MultipleFilterSearchRequest.Value | undefined; } export namespace MultipleFilterSearchRequest { diff --git a/src/api/types/NewsItemRequest.ts b/src/api/types/NewsItemRequest.ts index 89a1a61d..847c9d59 100644 --- a/src/api/types/NewsItemRequest.ts +++ b/src/api/types/NewsItemRequest.ts @@ -9,19 +9,19 @@ export interface NewsItemRequest { /** The title of the news item. */ title: string; /** The news item body, which may contain HTML. */ - body?: string; + body?: string | undefined; /** The id of the sender of the news item. Must be a teammate on the workspace. */ sender_id: number; /** News items will not be visible to your users in the assigned newsfeeds until they are set live. */ - state?: NewsItemRequest.State; + state?: NewsItemRequest.State | undefined; /** When set to `true`, the news item will appear in the messenger newsfeed without showing a notification badge. */ - deliver_silently?: boolean; + deliver_silently?: boolean | undefined; /** Label names displayed to users to categorize the news item. */ - labels?: string[]; + labels?: string[] | undefined; /** Ordered list of emoji reactions to the news item. When empty, reactions are disabled. */ - reactions?: (string | undefined)[]; + reactions?: (string | undefined)[] | undefined; /** A list of newsfeed_assignments to assign to the specified newsfeed. */ - newsfeed_assignments?: Intercom.NewsfeedAssignment[]; + newsfeed_assignments?: Intercom.NewsfeedAssignment[] | undefined; } export namespace NewsItemRequest { diff --git a/src/api/types/NotFoundErrorBody.ts b/src/api/types/NotFoundErrorBody.ts index de9109f3..eedb3a18 100644 --- a/src/api/types/NotFoundErrorBody.ts +++ b/src/api/types/NotFoundErrorBody.ts @@ -3,8 +3,7 @@ export interface NotFoundErrorBody { /** The type is error.list */ type: string; - /** */ - request_id?: string; + request_id?: string | undefined; /** An array of one or more error objects */ errors: NotFoundErrorBody.Errors.Item[]; } @@ -17,7 +16,7 @@ export namespace NotFoundErrorBody { /** ticket_not_found */ code: string; /** Ticket not found */ - message?: string; + message?: string | undefined; } } } diff --git a/src/api/types/NoteList.ts b/src/api/types/NoteList.ts index 5090713e..6f655631 100644 --- a/src/api/types/NoteList.ts +++ b/src/api/types/NoteList.ts @@ -7,9 +7,9 @@ import type * as Intercom from "../index.js"; */ export interface NoteList { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** An array of notes. */ - data?: Intercom.Note[]; + data?: Intercom.Note[] | undefined; /** A count of the total number of notes. */ - total_count?: number; + total_count?: number | undefined; } diff --git a/src/api/types/OffsetPages.ts b/src/api/types/OffsetPages.ts index 7118e2df..906828c8 100644 --- a/src/api/types/OffsetPages.ts +++ b/src/api/types/OffsetPages.ts @@ -4,10 +4,10 @@ export interface OffsetPages { /** the type of object `offset_pages` */ type: "offset_pages"; /** The current offset */ - page?: number; - next?: string; + page?: number | undefined; + next?: string | undefined; /** Number of results per page */ - per_page?: number; + per_page?: number | undefined; /** Total number of pages */ - total_pages?: number; + total_pages?: number | undefined; } diff --git a/src/api/types/OperatorWorkflowEvent.ts b/src/api/types/OperatorWorkflowEvent.ts index df8629d3..53ac48fe 100644 --- a/src/api/types/OperatorWorkflowEvent.ts +++ b/src/api/types/OperatorWorkflowEvent.ts @@ -4,20 +4,20 @@ * Contains details about name of the workflow for conversation part type operator_workflow_event. */ export interface OperatorWorkflowEvent { - workflow?: OperatorWorkflowEvent.Workflow; - event?: OperatorWorkflowEvent.Event; + workflow?: OperatorWorkflowEvent.Workflow | undefined; + event?: OperatorWorkflowEvent.Event | undefined; } export namespace OperatorWorkflowEvent { export interface Workflow { /** The name of the workflow */ - name?: string; + name?: string | undefined; } export interface Event { /** Type of the workflow event initiated */ - type?: string; + type?: string | undefined; /** Result of the workflow event */ - result?: string; + result?: string | undefined; } } diff --git a/src/api/types/PagesLink.ts b/src/api/types/PagesLink.ts index 59d698ff..4aa9fbe8 100644 --- a/src/api/types/PagesLink.ts +++ b/src/api/types/PagesLink.ts @@ -6,10 +6,10 @@ * Their responses are likely to contain a pages object that hosts pagination links which a client can use to paginate through the data without having to construct a query. The link relations for the pages field are as follows. */ export interface PagesLink { - type?: "pages"; - page?: number; + type?: "pages" | undefined; + page?: number | undefined; /** A link to the next page of results. A response that does not contain a next link does not have further data to fetch. */ - next?: string; - per_page?: number; - total_pages?: number; + next?: string | undefined; + per_page?: number | undefined; + total_pages?: number | undefined; } diff --git a/src/api/types/PaginatedResponse.ts b/src/api/types/PaginatedResponse.ts index 320b646d..d67a3353 100644 --- a/src/api/types/PaginatedResponse.ts +++ b/src/api/types/PaginatedResponse.ts @@ -7,12 +7,12 @@ import type * as Intercom from "../index.js"; */ export interface PaginatedResponse { /** The type of object */ - type?: PaginatedResponse.Type; - pages?: Intercom.CursorPages; + type?: PaginatedResponse.Type | undefined; + pages?: Intercom.CursorPages | undefined; /** A count of the total number of objects. */ - total_count?: number; + total_count?: number | undefined; /** An array of Objects */ - data?: Intercom.PaginatedResponseDataItem[]; + data?: Intercom.PaginatedResponseDataItem[] | undefined; } export namespace PaginatedResponse { diff --git a/src/api/types/PartAttachment.ts b/src/api/types/PartAttachment.ts index 3c01b778..984803cd 100644 --- a/src/api/types/PartAttachment.ts +++ b/src/api/types/PartAttachment.ts @@ -5,17 +5,17 @@ */ export interface PartAttachment { /** The type of attachment */ - type?: string; + type?: string | undefined; /** The name of the attachment */ - name?: string; + name?: string | undefined; /** The URL of the attachment */ - url?: string; + url?: string | undefined; /** The content type of the attachment */ - content_type?: string; + content_type?: string | undefined; /** The size of the attachment */ - filesize?: number; + filesize?: number | undefined; /** The width of the attachment */ - width?: number; + width?: number | undefined; /** The height of the attachment */ - height?: number; + height?: number | undefined; } diff --git a/src/api/types/PhoneSwitch.ts b/src/api/types/PhoneSwitch.ts index 5fbeb892..41e7d028 100644 --- a/src/api/types/PhoneSwitch.ts +++ b/src/api/types/PhoneSwitch.ts @@ -4,8 +4,7 @@ * Phone Switch Response */ export interface PhoneSwitch { - /** */ - type?: "phone_call_redirect"; + type?: "phone_call_redirect" | undefined; /** Phone number in E.164 format, that has received the SMS to continue the conversation in the Messenger. */ - phone?: string; + phone?: string | undefined; } diff --git a/src/api/types/Reference.ts b/src/api/types/Reference.ts index 7c9c82a3..588d9ec5 100644 --- a/src/api/types/Reference.ts +++ b/src/api/types/Reference.ts @@ -4,8 +4,6 @@ * reference to another object */ export interface Reference { - /** */ - type?: string; - /** */ - id?: string; + type?: string | undefined; + id?: string | undefined; } diff --git a/src/api/types/SearchRequest.ts b/src/api/types/SearchRequest.ts index be8ae5af..3e915885 100644 --- a/src/api/types/SearchRequest.ts +++ b/src/api/types/SearchRequest.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface SearchRequest { query: SearchRequest.Query; - pagination?: Intercom.StartingAfterPaging; + pagination?: Intercom.StartingAfterPaging | undefined; } export namespace SearchRequest { diff --git a/src/api/types/SegmentList.ts b/src/api/types/SegmentList.ts index cb3efe41..8023cd24 100644 --- a/src/api/types/SegmentList.ts +++ b/src/api/types/SegmentList.ts @@ -7,9 +7,9 @@ import type * as Intercom from "../index.js"; */ export interface SegmentList { /** The type of the object */ - type?: "segment.list"; + type?: "segment.list" | undefined; /** A list of Segment objects */ - segments?: Intercom.Segment[]; + segments?: Intercom.Segment[] | undefined; /** A pagination object, which may be empty, indicating no further pages to fetch. */ - pages?: Record; + pages?: Record | undefined; } diff --git a/src/api/types/SingleFilterSearchRequest.ts b/src/api/types/SingleFilterSearchRequest.ts index b51eb1a2..48e81670 100644 --- a/src/api/types/SingleFilterSearchRequest.ts +++ b/src/api/types/SingleFilterSearchRequest.ts @@ -5,11 +5,11 @@ */ export interface SingleFilterSearchRequest { /** The accepted field that you want to search on. */ - field?: string; + field?: string | undefined; /** The accepted operators you can use to define how you want to search for the value. */ - operator?: SingleFilterSearchRequest.Operator; + operator?: SingleFilterSearchRequest.Operator | undefined; /** The value that you want to search on. */ - value?: SingleFilterSearchRequest.Value; + value?: SingleFilterSearchRequest.Value | undefined; } export namespace SingleFilterSearchRequest { diff --git a/src/api/types/SlaApplied.ts b/src/api/types/SlaApplied.ts index 3ea77f62..615d9979 100644 --- a/src/api/types/SlaApplied.ts +++ b/src/api/types/SlaApplied.ts @@ -6,16 +6,16 @@ */ export interface SlaApplied { /** object type */ - type?: string; + type?: string | undefined; /** The name of the SLA as given by the teammate when it was created. */ - sla_name?: string; + sla_name?: string | undefined; /** * SLA statuses: * - `hit`: If there’s at least one hit event in the underlying sla_events table, and no “missed” or “canceled” events for the conversation. * - `missed`: If there are any missed sla_events for the conversation and no canceled events. If there’s even a single missed sla event, the status will always be missed. A missed status is not applied when the SLA expires, only the next time a teammate replies. * - `active`: An SLA has been applied to a conversation, but has not yet been fulfilled. SLA status is active only if there are no “hit, “missed”, or “canceled” events. */ - sla_status?: SlaApplied.SlaStatus; + sla_status?: SlaApplied.SlaStatus | undefined; } export namespace SlaApplied { diff --git a/src/api/types/SocialProfile.ts b/src/api/types/SocialProfile.ts index 78030405..79da5714 100644 --- a/src/api/types/SocialProfile.ts +++ b/src/api/types/SocialProfile.ts @@ -5,9 +5,9 @@ */ export interface SocialProfile { /** value is "social_profile" */ - type?: "social_profile"; + type?: "social_profile" | undefined; /** The name of the Social media profile */ - name?: string; + name?: string | undefined; /** The name of the Social media profile */ - url?: string; + url?: string | undefined; } diff --git a/src/api/types/StartingAfterPaging.ts b/src/api/types/StartingAfterPaging.ts index 6fc82b73..bddd3e4f 100644 --- a/src/api/types/StartingAfterPaging.ts +++ b/src/api/types/StartingAfterPaging.ts @@ -2,7 +2,7 @@ export interface StartingAfterPaging { /** The number of results to fetch per page. */ - per_page?: number; + per_page?: number | undefined; /** The cursor to use in the next request to get the next page of results. */ - starting_after?: string; + starting_after?: string | undefined; } diff --git a/src/api/types/SubscriptionTypeList.ts b/src/api/types/SubscriptionTypeList.ts index 134688b1..d0a8d5b2 100644 --- a/src/api/types/SubscriptionTypeList.ts +++ b/src/api/types/SubscriptionTypeList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface SubscriptionTypeList { /** The type of the object */ - type?: "list"; + type?: "list" | undefined; /** A list of subscription type objects associated with the workspace . */ - data?: Intercom.SubscriptionType[]; + data?: Intercom.SubscriptionType[] | undefined; } diff --git a/src/api/types/TagCompanyRequest.ts b/src/api/types/TagCompanyRequest.ts index 4f4affb5..47f794d6 100644 --- a/src/api/types/TagCompanyRequest.ts +++ b/src/api/types/TagCompanyRequest.ts @@ -16,9 +16,9 @@ export namespace TagCompanyRequest { export namespace Companies { export interface Item { /** The Intercom defined id representing the company. */ - id?: string; + id?: string | undefined; /** The company id you have defined for the company. */ - company_id?: string; + company_id?: string | undefined; } } } diff --git a/src/api/types/TagList.ts b/src/api/types/TagList.ts index 54b9506c..eee336bc 100644 --- a/src/api/types/TagList.ts +++ b/src/api/types/TagList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface TagList { /** The type of the object */ - type?: "list"; + type?: "list" | undefined; /** A list of tags objects associated with the workspace . */ - data?: Intercom.Tag[]; + data?: Intercom.Tag[] | undefined; } diff --git a/src/api/types/TagMultipleUsersRequest.ts b/src/api/types/TagMultipleUsersRequest.ts index fc697987..6599d3a4 100644 --- a/src/api/types/TagMultipleUsersRequest.ts +++ b/src/api/types/TagMultipleUsersRequest.ts @@ -15,7 +15,7 @@ export namespace TagMultipleUsersRequest { export namespace Users { export interface Item { /** The Intercom defined id representing the user. */ - id?: string; + id?: string | undefined; } } } diff --git a/src/api/types/Tags.ts b/src/api/types/Tags.ts index 0d3680ce..8bfd07e6 100644 --- a/src/api/types/Tags.ts +++ b/src/api/types/Tags.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface Tags { /** The type of the object */ - type?: "tag.list"; + type?: "tag.list" | undefined; /** A list of tags objects associated with the conversation. */ - tags?: Intercom.Tag[]; + tags?: Intercom.Tag[] | undefined; } diff --git a/src/api/types/TeamList.ts b/src/api/types/TeamList.ts index def5cbe1..f77f428d 100644 --- a/src/api/types/TeamList.ts +++ b/src/api/types/TeamList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface TeamList { /** The type of the object */ - type?: "team.list"; + type?: "team.list" | undefined; /** A list of team objects */ - teams?: Intercom.Team[]; + teams?: Intercom.Team[] | undefined; } diff --git a/src/api/types/TeamPriorityLevel.ts b/src/api/types/TeamPriorityLevel.ts index 07d6bae5..47d67433 100644 --- a/src/api/types/TeamPriorityLevel.ts +++ b/src/api/types/TeamPriorityLevel.ts @@ -5,7 +5,7 @@ */ export interface TeamPriorityLevel { /** The primary team ids for the team */ - primary_team_ids?: number[]; + primary_team_ids?: number[] | undefined; /** The secondary team ids for the team */ - secondary_team_ids?: number[]; + secondary_team_ids?: number[] | undefined; } diff --git a/src/api/types/TicketList.ts b/src/api/types/TicketList.ts index e512f129..8faa1922 100644 --- a/src/api/types/TicketList.ts +++ b/src/api/types/TicketList.ts @@ -7,10 +7,10 @@ import type * as Intercom from "../index.js"; */ export interface TicketList { /** Always ticket.list */ - type?: "ticket.list"; + type?: "ticket.list" | undefined; /** The list of ticket objects */ - tickets?: (Intercom.Ticket | undefined)[]; + tickets?: (Intercom.Ticket | undefined)[] | undefined; /** A count of the total number of objects. */ - total_count?: number; - pages?: Intercom.CursorPages; + total_count?: number | undefined; + pages?: Intercom.CursorPages | undefined; } diff --git a/src/api/types/TicketPartAuthor.ts b/src/api/types/TicketPartAuthor.ts index e0ea7ff3..38a5477f 100644 --- a/src/api/types/TicketPartAuthor.ts +++ b/src/api/types/TicketPartAuthor.ts @@ -5,13 +5,13 @@ */ export interface TicketPartAuthor { /** The type of the author */ - type?: TicketPartAuthor.Type; + type?: TicketPartAuthor.Type | undefined; /** The id of the author */ - id?: string; + id?: string | undefined; /** The name of the author */ - name?: string; + name?: string | undefined; /** The email of the author */ - email?: string; + email?: string | undefined; } export namespace TicketPartAuthor { diff --git a/src/api/types/TicketParts.ts b/src/api/types/TicketParts.ts index 9ff75bbe..3fd65eb9 100644 --- a/src/api/types/TicketParts.ts +++ b/src/api/types/TicketParts.ts @@ -6,10 +6,8 @@ import type * as Intercom from "../index.js"; * A list of Ticket Part objects for each note and event in the ticket. There is a limit of 500 parts. */ export interface TicketParts { - /** */ - type?: "ticket_part.list"; + type?: "ticket_part.list" | undefined; /** A list of Ticket Part objects for each ticket. There is a limit of 500 parts. */ - ticket_parts?: Intercom.TicketPart[]; - /** */ - total_count?: number; + ticket_parts?: Intercom.TicketPart[] | undefined; + total_count?: number | undefined; } diff --git a/src/api/types/TicketReply.ts b/src/api/types/TicketReply.ts index f86b2ef4..9290a5a9 100644 --- a/src/api/types/TicketReply.ts +++ b/src/api/types/TicketReply.ts @@ -7,22 +7,22 @@ import type * as Intercom from "../index.js"; */ export interface TicketReply { /** Always ticket_part */ - type?: "ticket_part"; + type?: "ticket_part" | undefined; /** The id representing the part. */ - id?: string; + id?: string | undefined; /** Type of the part */ - part_type?: TicketReply.PartType; + part_type?: TicketReply.PartType | undefined; /** The message body, which may contain HTML. */ - body?: string; + body?: string | undefined; /** The time the note was created. */ - created_at?: number; + created_at?: number | undefined; /** The last time the note was updated. */ - updated_at?: number; - author?: Intercom.TicketPartAuthor; + updated_at?: number | undefined; + author?: Intercom.TicketPartAuthor | undefined; /** A list of attachments for the part. */ - attachments?: Intercom.PartAttachment[]; + attachments?: Intercom.PartAttachment[] | undefined; /** Whether or not the ticket part has been redacted. */ - redacted?: boolean; + redacted?: boolean | undefined; } export namespace TicketReply { diff --git a/src/api/types/TicketStateList.ts b/src/api/types/TicketStateList.ts index ac2fbc51..c2d634c9 100644 --- a/src/api/types/TicketStateList.ts +++ b/src/api/types/TicketStateList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface TicketStateList { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of ticket states associated with a given ticket type. */ - data?: (Intercom.TicketStateDetailed | undefined)[]; + data?: (Intercom.TicketStateDetailed | undefined)[] | undefined; } diff --git a/src/api/types/TicketTypeAttribute.ts b/src/api/types/TicketTypeAttribute.ts index 855266f6..a6f86b01 100644 --- a/src/api/types/TicketTypeAttribute.ts +++ b/src/api/types/TicketTypeAttribute.ts @@ -5,39 +5,39 @@ */ export interface TicketTypeAttribute { /** String representing the object's type. Always has the value `ticket_type_attribute`. */ - type?: string; + type?: string | undefined; /** The id representing the ticket type attribute. */ - id?: string; + id?: string | undefined; /** The id of the workspace that the ticket type attribute belongs to. */ - workspace_id?: string; + workspace_id?: string | undefined; /** The name of the ticket type attribute */ - name?: string; + name?: string | undefined; /** The description of the ticket type attribute */ - description?: string; + description?: string | undefined; /** The type of the data attribute (allowed values: "string list integer decimal boolean datetime files") */ - data_type?: TicketTypeAttribute.DataType; + data_type?: TicketTypeAttribute.DataType | undefined; /** Input options for the attribute */ - input_options?: Record; + input_options?: Record | undefined; /** The order of the attribute against other attributes */ - order?: number; + order?: number | undefined; /** Whether the attribute is required or not for teammates. */ - required_to_create?: boolean; + required_to_create?: boolean | undefined; /** Whether the attribute is required or not for contacts. */ - required_to_create_for_contacts?: boolean; + required_to_create_for_contacts?: boolean | undefined; /** Whether the attribute is visible or not to teammates. */ - visible_on_create?: boolean; + visible_on_create?: boolean | undefined; /** Whether the attribute is visible or not to contacts. */ - visible_to_contacts?: boolean; + visible_to_contacts?: boolean | undefined; /** Whether the attribute is built in or not. */ - default?: boolean; + default?: boolean | undefined; /** The id of the ticket type that the attribute belongs to. */ - ticket_type_id?: number; + ticket_type_id?: number | undefined; /** Whether the ticket type attribute is archived or not. */ - archived?: boolean; + archived?: boolean | undefined; /** The date and time the ticket type attribute was created. */ - created_at?: number; + created_at?: number | undefined; /** The date and time the ticket type attribute was last updated. */ - updated_at?: number; + updated_at?: number | undefined; } export namespace TicketTypeAttribute { diff --git a/src/api/types/TicketTypeAttributeList.ts b/src/api/types/TicketTypeAttributeList.ts index 6a9b00dc..ab8bf73e 100644 --- a/src/api/types/TicketTypeAttributeList.ts +++ b/src/api/types/TicketTypeAttributeList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface TicketTypeAttributeList { /** String representing the object's type. Always has the value `ticket_type_attributes.list`. */ - type?: string; + type?: string | undefined; /** A list of ticket type attributes associated with a given ticket type. */ - ticket_type_attributes?: (Intercom.TicketTypeAttribute | undefined)[]; + ticket_type_attributes?: (Intercom.TicketTypeAttribute | undefined)[] | undefined; } diff --git a/src/api/types/TicketTypeList.ts b/src/api/types/TicketTypeList.ts index d76acea8..43e8bc39 100644 --- a/src/api/types/TicketTypeList.ts +++ b/src/api/types/TicketTypeList.ts @@ -7,7 +7,7 @@ import type * as Intercom from "../index.js"; */ export interface TicketTypeList { /** String representing the object's type. Always has the value `list`. */ - type?: string; + type?: string | undefined; /** A list of ticket_types associated with a given workspace. */ - data?: (Intercom.TicketType | undefined)[]; + data?: (Intercom.TicketType | undefined)[] | undefined; } diff --git a/src/api/types/Translation.ts b/src/api/types/Translation.ts index 3d656a16..d1edad05 100644 --- a/src/api/types/Translation.ts +++ b/src/api/types/Translation.ts @@ -5,9 +5,9 @@ */ export interface Translation { /** The localised name of the subscription type. */ - name?: string; + name?: string | undefined; /** The localised description of the subscription type. */ - description?: string; + description?: string | undefined; /** The two character identifier for the language of the translation object. */ - locale?: string; + locale?: string | undefined; } diff --git a/src/api/types/UntagCompanyRequest.ts b/src/api/types/UntagCompanyRequest.ts index 09886bd1..d0d73881 100644 --- a/src/api/types/UntagCompanyRequest.ts +++ b/src/api/types/UntagCompanyRequest.ts @@ -16,11 +16,11 @@ export namespace UntagCompanyRequest { export namespace Companies { export interface Item { /** The Intercom defined id representing the company. */ - id?: string; + id?: string | undefined; /** The company id you have defined for the company. */ - company_id?: string; + company_id?: string | undefined; /** Always set to true */ - untag?: boolean; + untag?: boolean | undefined; } } } diff --git a/src/api/types/UpdateArticleRequestBody.ts b/src/api/types/UpdateArticleRequestBody.ts index 3a5100b8..56712ae4 100644 --- a/src/api/types/UpdateArticleRequestBody.ts +++ b/src/api/types/UpdateArticleRequestBody.ts @@ -1,7 +1,7 @@ // This file was auto-generated by Fern from our API Definition. export interface UpdateArticleRequestBody { - parent_type?: UpdateArticleRequestBody.ParentType; + parent_type?: UpdateArticleRequestBody.ParentType | undefined; } export namespace UpdateArticleRequestBody { diff --git a/src/api/types/UpdateCompanyRequestBody.ts b/src/api/types/UpdateCompanyRequestBody.ts index 8949ca97..d53e99db 100644 --- a/src/api/types/UpdateCompanyRequestBody.ts +++ b/src/api/types/UpdateCompanyRequestBody.ts @@ -5,17 +5,17 @@ */ export interface UpdateCompanyRequestBody { /** The name of the Company */ - name?: string; + name?: string | undefined; /** The name of the plan you have associated with the company. */ - plan?: string; + plan?: string | undefined; /** The number of employees in this company. */ - size?: number; + size?: number | undefined; /** The URL for this company's website. Please note that the value specified here is not validated. Accepts any string. */ - website?: string; + website?: string | undefined; /** The industry that this company operates in. */ - industry?: string; + industry?: string | undefined; /** A hash of key/value pairs containing any other data about the company you want Intercom to store. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; /** How much revenue the company generates for your business. Note that this will truncate floats. i.e. it only allow for whole integers, 155.98 will be truncated to 155. Note that this has an upper limit of 2**31-1 or 2147483647.. */ - monthly_spend?: number; + monthly_spend?: number | undefined; } diff --git a/src/api/types/UpdateDataAttributeRequestBody.ts b/src/api/types/UpdateDataAttributeRequestBody.ts index 6524ae99..81ebba1b 100644 --- a/src/api/types/UpdateDataAttributeRequestBody.ts +++ b/src/api/types/UpdateDataAttributeRequestBody.ts @@ -1,8 +1,5 @@ // This file was auto-generated by Fern from our API Definition. -/** - * - */ export type UpdateDataAttributeRequestBody = | { options: { diff --git a/src/api/types/Visitor.ts b/src/api/types/Visitor.ts index 5aa58457..f081fd1b 100644 --- a/src/api/types/Visitor.ts +++ b/src/api/types/Visitor.ts @@ -13,104 +13,102 @@ export interface Visitor { /** Automatically generated identifier for the Visitor. */ user_id: string; /** Identifies if this visitor is anonymous. */ - anonymous?: boolean; + anonymous?: boolean | undefined; /** The email of the visitor. */ - email?: string; + email?: string | undefined; /** The phone number of the visitor. */ - phone?: string; + phone?: string | undefined; /** The name of the visitor. */ - name?: string; + name?: string | undefined; /** The pseudonym of the visitor. */ - pseudonym?: string; - avatar?: Visitor.Avatar; + pseudonym?: string | undefined; + avatar?: Visitor.Avatar | undefined; /** The id of the app the visitor is associated with. */ - app_id?: string; - companies?: Visitor.Companies; - location_data?: Visitor.LocationData; + app_id?: string | undefined; + companies?: Visitor.Companies | undefined; + location_data?: Visitor.LocationData | undefined; /** The time the Lead last recorded making a request. */ - las_request_at?: number; + las_request_at?: number | undefined; /** The time the Visitor was added to Intercom. */ - created_at?: number; + created_at?: number | undefined; /** The time the Visitor was added to Intercom. */ - remote_created_at?: number; + remote_created_at?: number | undefined; /** The time the Visitor signed up for your product. */ - signed_up_at?: number; + signed_up_at?: number | undefined; /** The last time the Visitor was updated. */ - updated_at?: number; + updated_at?: number | undefined; /** The number of sessions the Visitor has had. */ - session_count?: number; - social_profiles?: Visitor.SocialProfiles; + session_count?: number | undefined; + social_profiles?: Visitor.SocialProfiles | undefined; /** The id of the admin that owns the Visitor. */ - owner_id?: string; + owner_id?: string | undefined; /** Whether the Visitor is unsubscribed from emails. */ - unsubscribed_from_emails?: boolean; + unsubscribed_from_emails?: boolean | undefined; /** Identifies if this visitor has marked an email as spam. */ - marked_email_as_spam?: boolean; + marked_email_as_spam?: boolean | undefined; /** Identifies if this visitor has had a hard bounce. */ - has_hard_bounced?: boolean; - tags?: Visitor.Tags; - segments?: Visitor.Segments; + has_hard_bounced?: boolean | undefined; + tags?: Visitor.Tags | undefined; + segments?: Visitor.Segments | undefined; /** The custom attributes you have set on the Visitor. */ - custom_attributes?: Record; + custom_attributes?: Record | undefined; /** The referer of the visitor. */ - referrer?: string; + referrer?: string | undefined; /** The utm_campaign of the visitor. */ - utm_campaign?: string; + utm_campaign?: string | undefined; /** The utm_content of the visitor. */ - utm_content?: string; + utm_content?: string | undefined; /** The utm_medium of the visitor. */ - utm_medium?: string; + utm_medium?: string | undefined; /** The utm_source of the visitor. */ - utm_source?: string; + utm_source?: string | undefined; /** The utm_term of the visitor. */ - utm_term?: string; + utm_term?: string | undefined; /** Identifies if this visitor has do not track enabled. */ - do_not_track?: boolean; + do_not_track?: boolean | undefined; } export namespace Visitor { export interface Avatar { - /** */ - type?: string; + type?: string | undefined; /** This object represents the avatar associated with the visitor. */ - image_url?: string; + image_url?: string | undefined; } export interface Companies { /** The type of the object */ - type?: "company.list"; - companies?: Intercom.Company[]; + type?: "company.list" | undefined; + companies?: Intercom.Company[] | undefined; } export interface LocationData { - /** */ - type?: string; + type?: string | undefined; /** The city name of the visitor. */ - city_name?: string; + city_name?: string | undefined; /** The continent code of the visitor. */ - continent_code?: string; + continent_code?: string | undefined; /** The country code of the visitor. */ - country_code?: string; + country_code?: string | undefined; /** The country name of the visitor. */ - country_name?: string; + country_name?: string | undefined; /** The postal code of the visitor. */ - postal_code?: string; + postal_code?: string | undefined; /** The region name of the visitor. */ - region_name?: string; + region_name?: string | undefined; /** The timezone of the visitor. */ - timezone?: string; + timezone?: string | undefined; } export interface SocialProfiles { /** The type of the object */ - type?: "social_profile.list"; - social_profiles?: string[]; + type?: "social_profile.list" | undefined; + social_profiles?: string[] | undefined; } export interface Tags { /** The type of the object */ - type?: "tag.list"; - tags?: Tags.Tags.Item[]; + type?: "tag.list" | undefined; + tags?: Tags.Tags.Item[] | undefined; } export namespace Tags { @@ -119,18 +117,18 @@ export namespace Visitor { export namespace Tags { export interface Item { /** The type of the object */ - type?: "tag"; + type?: "tag" | undefined; /** The id of the tag. */ - id?: string; + id?: string | undefined; /** The name of the tag. */ - name?: string; + name?: string | undefined; } } } export interface Segments { /** The type of the object */ - type?: "segment.list"; - segments?: string[]; + type?: "segment.list" | undefined; + segments?: string[] | undefined; } } diff --git a/src/api/types/VisitorDeletedObject.ts b/src/api/types/VisitorDeletedObject.ts index 6a3cc196..874c5a4c 100644 --- a/src/api/types/VisitorDeletedObject.ts +++ b/src/api/types/VisitorDeletedObject.ts @@ -5,9 +5,9 @@ */ export interface VisitorDeletedObject { /** The unique identifier for the visitor which is given by Intercom. */ - id?: string; + id?: string | undefined; /** The type of object which was deleted */ - type?: "visitor"; + type?: "visitor" | undefined; /** Automatically generated identifier for the Visitor. */ - user_id?: string; + user_id?: string | undefined; } diff --git a/src/api/types/WhatsappMessageStatusList.ts b/src/api/types/WhatsappMessageStatusList.ts index b1d0e8d8..de1780e2 100644 --- a/src/api/types/WhatsappMessageStatusList.ts +++ b/src/api/types/WhatsappMessageStatusList.ts @@ -18,7 +18,7 @@ export namespace WhatsappMessageStatusList { /** Total number of pages */ total_pages: number; /** Information for fetching next page (null if no more pages) */ - next?: Pages.Next; + next?: Pages.Next | undefined; } export namespace Pages { @@ -27,7 +27,7 @@ export namespace WhatsappMessageStatusList { */ export interface Next { /** Cursor for the next page */ - starting_after?: string; + starting_after?: string | undefined; } } @@ -50,7 +50,7 @@ export namespace WhatsappMessageStatusList { /** WhatsApp's message identifier */ whatsapp_message_id: string; /** Name of the WhatsApp template used */ - template_name?: string; + template_name?: string | undefined; } export namespace Item { diff --git a/src/api/types/index.ts b/src/api/types/index.ts index d0b6e87d..0751a3b8 100644 --- a/src/api/types/index.ts +++ b/src/api/types/index.ts @@ -64,10 +64,8 @@ export * from "./ConversationStatistics.js"; export * from "./ConversationTeammates.js"; export * from "./CreateArticleRequest.js"; export * from "./CreateContactRequest.js"; -export * from "./CreateContactRequestTwo.js"; export * from "./CreateDataAttributeRequest.js"; export * from "./CreateDataEventRequest.js"; -export * from "./CreateDataEventRequestTwo.js"; export * from "./CreateInternalArticleRequest.js"; export * from "./CreateMessageRequest.js"; export * from "./CreateOrUpdateCompanyRequest.js"; @@ -157,7 +155,6 @@ export * from "./UpdateArticleRequestBody.js"; export * from "./UpdateCompanyRequestBody.js"; export * from "./UpdateDataAttributeRequestBody.js"; export * from "./UpdateVisitorRequest.js"; -export * from "./UpdateVisitorRequestOne.js"; export * from "./Visitor.js"; export * from "./VisitorDeletedObject.js"; export * from "./WhatsappMessageStatusList.js"; diff --git a/src/auth/BearerAuthProvider.ts b/src/auth/BearerAuthProvider.ts index fc69deba..cc385c34 100644 --- a/src/auth/BearerAuthProvider.ts +++ b/src/auth/BearerAuthProvider.ts @@ -3,29 +3,29 @@ import * as core from "../core/index.js"; import * as errors from "../errors/index.js"; -export namespace BearerAuthProvider { - export interface Options { - token?: core.Supplier; - } -} +const TOKEN_PARAM = "token" as const; +const ENV_TOKEN = "INTERCOM_API_KEY" as const; export class BearerAuthProvider implements core.AuthProvider { - private readonly token: core.Supplier | undefined; + private readonly options: BearerAuthProvider.Options; constructor(options: BearerAuthProvider.Options) { - this.token = options.token; + this.options = options; } - public static canCreate(options: BearerAuthProvider.Options): boolean { - return options.token != null || process.env?.INTERCOM_API_KEY != null; + public static canCreate(options: Partial): boolean { + return options?.[TOKEN_PARAM] != null || process.env?.[ENV_TOKEN] != null; } - public async getAuthRequest(_arg?: { endpointMetadata?: core.EndpointMetadata }): Promise { - const token = (await core.Supplier.get(this.token)) ?? process.env?.INTERCOM_API_KEY; + public async getAuthRequest({ + endpointMetadata, + }: { + endpointMetadata?: core.EndpointMetadata; + } = {}): Promise { + const token = (await core.Supplier.get(this.options[TOKEN_PARAM])) ?? process.env?.[ENV_TOKEN]; if (token == null) { throw new errors.IntercomError({ - message: - "Please specify a token by either passing it in to the constructor or initializing a INTERCOM_API_KEY environment variable", + message: BearerAuthProvider.AUTH_CONFIG_ERROR_MESSAGE, }); } @@ -34,3 +34,15 @@ export class BearerAuthProvider implements core.AuthProvider { }; } } + +export namespace BearerAuthProvider { + export const AUTH_SCHEME = "bearerAuth" as const; + export const AUTH_CONFIG_ERROR_MESSAGE: string = + `Please provide '${TOKEN_PARAM}' when initializing the client, or set the '${ENV_TOKEN}' environment variable` as const; + export type Options = AuthOptions; + export type AuthOptions = { [TOKEN_PARAM]?: core.Supplier | undefined }; + + export function createInstance(options: Options): core.AuthProvider { + return new BearerAuthProvider(options); + } +} diff --git a/src/core/auth/AuthProvider.ts b/src/core/auth/AuthProvider.ts index 895a50ff..c9478669 100644 --- a/src/core/auth/AuthProvider.ts +++ b/src/core/auth/AuthProvider.ts @@ -4,3 +4,12 @@ import type { AuthRequest } from "./AuthRequest.js"; export interface AuthProvider { getAuthRequest(arg?: { endpointMetadata?: EndpointMetadata }): Promise; } + +export function isAuthProvider(value: unknown): value is AuthProvider { + return ( + typeof value === "object" && + value !== null && + "getAuthRequest" in value && + typeof value.getAuthRequest === "function" + ); +} diff --git a/src/core/auth/BasicAuth.ts b/src/core/auth/BasicAuth.ts index a6423591..f34fca5c 100644 --- a/src/core/auth/BasicAuth.ts +++ b/src/core/auth/BasicAuth.ts @@ -1,8 +1,8 @@ import { base64Decode, base64Encode } from "../base64.js"; export interface BasicAuth { - username: string; - password: string; + username?: string; + password?: string; } const BASIC_AUTH_HEADER_PREFIX = /^Basic /i; @@ -12,7 +12,12 @@ export const BasicAuth = { if (basicAuth == null) { return undefined; } - const token = base64Encode(`${basicAuth.username}:${basicAuth.password}`); + const username = basicAuth.username ?? ""; + const password = basicAuth.password ?? ""; + if (username === "" && password === "") { + return undefined; + } + const token = base64Encode(`${username}:${password}`); return `Basic ${token}`; }, fromAuthorizationHeader: (header: string): BasicAuth => { diff --git a/src/core/auth/index.ts b/src/core/auth/index.ts index 2215b227..77effd09 100644 --- a/src/core/auth/index.ts +++ b/src/core/auth/index.ts @@ -1,4 +1,4 @@ -export type { AuthProvider } from "./AuthProvider.js"; +export { type AuthProvider, isAuthProvider } from "./AuthProvider.js"; export type { AuthRequest } from "./AuthRequest.js"; export { BasicAuth } from "./BasicAuth.js"; export { BearerToken } from "./BearerToken.js"; diff --git a/src/core/fetcher/BinaryResponse.ts b/src/core/fetcher/BinaryResponse.ts index bca7f4c7..b9e40fb6 100644 --- a/src/core/fetcher/BinaryResponse.ts +++ b/src/core/fetcher/BinaryResponse.ts @@ -14,7 +14,7 @@ export type BinaryResponse = { * [MDN Reference](https://developer.mozilla.org/docs/Web/API/Request/bytes) * Some versions of the Fetch API may not support this method. */ - bytes?(): ReturnType; + bytes?(): Promise; }; export function getBinaryResponse(response: Response): BinaryResponse { diff --git a/src/core/fetcher/EndpointSupplier.ts b/src/core/fetcher/EndpointSupplier.ts index 8079841c..aad81f0d 100644 --- a/src/core/fetcher/EndpointSupplier.ts +++ b/src/core/fetcher/EndpointSupplier.ts @@ -1,10 +1,10 @@ import type { EndpointMetadata } from "./EndpointMetadata.js"; import type { Supplier } from "./Supplier.js"; -type EndpointSupplierFn = (arg: { endpointMetadata: EndpointMetadata }) => T | Promise; +type EndpointSupplierFn = (arg: { endpointMetadata?: EndpointMetadata }) => T | Promise; export type EndpointSupplier = Supplier | EndpointSupplierFn; export const EndpointSupplier = { - get: async (supplier: EndpointSupplier, arg: { endpointMetadata: EndpointMetadata }): Promise => { + get: async (supplier: EndpointSupplier, arg: { endpointMetadata?: EndpointMetadata }): Promise => { if (typeof supplier === "function") { return (supplier as EndpointSupplierFn)(arg); } else { diff --git a/src/core/fetcher/Fetcher.ts b/src/core/fetcher/Fetcher.ts index 58bb0e3e..b8456abe 100644 --- a/src/core/fetcher/Fetcher.ts +++ b/src/core/fetcher/Fetcher.ts @@ -7,11 +7,13 @@ import { EndpointSupplier } from "./EndpointSupplier.js"; import { getErrorResponseBody } from "./getErrorResponseBody.js"; import { getFetchFn } from "./getFetchFn.js"; import { getRequestBody } from "./getRequestBody.js"; -import { getResponseBody } from "./getResponseBody.js"; +import { getResponseBody, isResponseBodyError } from "./getResponseBody.js"; import { Headers } from "./Headers.js"; -import { makeRequest } from "./makeRequest.js"; +import { clearResponseTimeout, makeRequest } from "./makeRequest.js"; import { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; +import { redactUrl, SENSITIVE_QUERY_PARAMS } from "./redactUrl.js"; import { requestWithRetries } from "./requestWithRetries.js"; +import { TIMEOUT } from "./signals.js"; export type FetchFunction = (args: Fetcher.Args) => Promise>; @@ -20,8 +22,14 @@ export declare namespace Fetcher { url: string; method: string; contentType?: string; - headers?: Record | null | undefined>; + headers?: Record; + /** + * @deprecated Prefer `queryString` (produced by `core.url.queryBuilder()`). + * Retained for backwards compatibility with custom fetchers and callers that + * still construct request args with a query-parameter object. + */ queryParameters?: Record; + queryString?: string; body?: unknown; timeoutMs?: number; maxRetries?: number; @@ -56,11 +64,13 @@ export declare namespace Fetcher { export interface TimeoutError { reason: "timeout"; + cause?: unknown; } export interface UnknownError { reason: "unknown"; errorMessage: string; + cause?: unknown; } } @@ -95,130 +105,31 @@ function redactHeaders(headers: Headers | Record): Record): Record | undefined { +function redactQueryParameters( + queryParameters: Record | undefined, +): Record | undefined { if (queryParameters == null) { - return queryParameters; + return undefined; } const redacted: Record = {}; for (const [key, value] of Object.entries(queryParameters)) { - if (SENSITIVE_QUERY_PARAMS.has(key.toLowerCase())) { - redacted[key] = "[REDACTED]"; - } else { - redacted[key] = value; - } + redacted[key] = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()) ? "[REDACTED]" : value; } return redacted; } -function redactUrl(url: string): string { - const protocolIndex = url.indexOf("://"); - if (protocolIndex === -1) return url; - - const afterProtocol = protocolIndex + 3; - - // Find the first delimiter that marks the end of the authority section - const pathStart = url.indexOf("/", afterProtocol); - let queryStart = url.indexOf("?", afterProtocol); - let fragmentStart = url.indexOf("#", afterProtocol); - - const firstDelimiter = Math.min( - pathStart === -1 ? url.length : pathStart, - queryStart === -1 ? url.length : queryStart, - fragmentStart === -1 ? url.length : fragmentStart, - ); - - // Find the LAST @ before the delimiter (handles multiple @ in credentials) - let atIndex = -1; - for (let i = afterProtocol; i < firstDelimiter; i++) { - if (url[i] === "@") { - atIndex = i; - } - } - - if (atIndex !== -1) { - url = `${url.slice(0, afterProtocol)}[REDACTED]@${url.slice(atIndex + 1)}`; - } - - // Recalculate queryStart since url might have changed - queryStart = url.indexOf("?"); - if (queryStart === -1) return url; - - fragmentStart = url.indexOf("#", queryStart); - const queryEnd = fragmentStart !== -1 ? fragmentStart : url.length; - const queryString = url.slice(queryStart + 1, queryEnd); - - if (queryString.length === 0) return url; - - // FAST PATH: Quick check if any sensitive keywords present - // Using indexOf is faster than regex for simple substring matching - const lower = queryString.toLowerCase(); - const hasSensitive = - lower.includes("token") || - lower.includes("key") || - lower.includes("password") || - lower.includes("passwd") || - lower.includes("secret") || - lower.includes("session") || - lower.includes("auth"); - - if (!hasSensitive) { - return url; - } - - // SLOW PATH: Parse and redact - const redactedParams: string[] = []; - const params = queryString.split("&"); - - for (const param of params) { - const equalIndex = param.indexOf("="); - if (equalIndex === -1) { - redactedParams.push(param); - continue; - } - - const key = param.slice(0, equalIndex); - let shouldRedact = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()); - - if (!shouldRedact && key.includes("%")) { - try { - const decodedKey = decodeURIComponent(key); - shouldRedact = SENSITIVE_QUERY_PARAMS.has(decodedKey.toLowerCase()); - } catch {} - } - - redactedParams.push(shouldRedact ? `${key}=[REDACTED]` : param); - } - - return url.slice(0, queryStart + 1) + redactedParams.join("&") + url.slice(queryEnd); -} - async function getHeaders(args: Fetcher.Args): Promise { const newHeaders: Headers = new Headers(); newHeaders.set( "Accept", - args.responseType === "json" ? "application/json" : args.responseType === "text" ? "text/plain" : "*/*", + args.responseType === "json" + ? "application/json" + : args.responseType === "text" + ? "text/plain" + : args.responseType === "sse" + ? "text/event-stream" + : "*/*", ); if (args.body !== undefined && args.contentType != null) { newHeaders.set("Content-Type", args.contentType); @@ -242,8 +153,18 @@ async function getHeaders(args: Fetcher.Args): Promise { return newHeaders; } +function isJsonContentType(contentType: string | null): boolean { + const mediaType = contentType?.split(";")[0]?.trim().toLowerCase() ?? ""; + return mediaType === "application/json" || mediaType === "text/json" || mediaType.endsWith("+json"); +} + export async function fetcherImpl(args: Fetcher.Args): Promise> { - const url = createRequestUrl(args.url, args.queryParameters); + let url = args.url; + if (args.queryString != null && args.queryString.length > 0) { + url = `${url}?${args.queryString}`; + } else { + url = createRequestUrl(args.url, args.queryParameters); + } const requestBody: BodyInit | undefined = await getRequestBody({ body: args.body, type: args.requestType ?? "other", @@ -263,10 +184,18 @@ export async function fetcherImpl(args: Fetcher.Args): Promise - makeRequest( + async () => { + // A retry means the previous attempt is over; stop its timer now rather than at the end. + for (const previousResponse of attemptResponses) { + clearResponseTimeout(previousResponse); + } + const attemptResponse = await makeRequest( fetchFn, url, args.method, @@ -276,8 +205,14 @@ export async function fetcherImpl(args: Fetcher.Args): Promise= 200 && response.status < 400) { @@ -291,6 +226,18 @@ export async function fetcherImpl(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise(args: Fetcher.Args): Promise { + *entries(): IterableIterator<[string, string]> { for (const [key, values] of this.headers.entries()) { yield [key, values.join(", ")]; } } - *keys(): HeadersIterator { + *keys(): IterableIterator { yield* this.headers.keys(); } - *values(): HeadersIterator { + *values(): IterableIterator { for (const values of this.headers.values()) { yield values.join(", "); } } - [Symbol.iterator](): HeadersIterator<[string, string]> { + [Symbol.iterator](): IterableIterator<[string, string]> { return this.entries(); } }; diff --git a/src/core/fetcher/getErrorResponseBody.ts b/src/core/fetcher/getErrorResponseBody.ts index 7cf4e623..a8bcfd91 100644 --- a/src/core/fetcher/getErrorResponseBody.ts +++ b/src/core/fetcher/getErrorResponseBody.ts @@ -1,10 +1,26 @@ import { fromJson } from "../json.js"; -import { getResponseBody } from "./getResponseBody.js"; +import { getResponseBody, isResponseBodyError } from "./getResponseBody.js"; + +/** Parses a JSON error body, falling back to the raw text so the status and body are never lost. */ +function parseJsonErrorBody(text: string): unknown { + if (text.length === 0) { + return undefined; + } + try { + return fromJson(text); + } catch { + return text; + } +} export async function getErrorResponseBody(response: Response): Promise { let contentType = response.headers.get("Content-Type")?.toLowerCase(); if (contentType == null || contentType.length === 0) { - return getResponseBody(response); + const body = await getResponseBody(response); + if (isResponseBodyError(body)) { + return body.error.reason === "non-json" ? body.error.rawBody : undefined; + } + return body; } if (contentType.indexOf(";") !== -1) { @@ -16,14 +32,11 @@ export async function getErrorResponseBody(response: Response): Promise case "application/ld+json": case "application/problem+json": case "application/vnd.api+json": - case "text/json": { - const text = await response.text(); - return text.length > 0 ? fromJson(text) : undefined; - } + case "text/json": + return parseJsonErrorBody(await response.text()); default: if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) { - const text = await response.text(); - return text.length > 0 ? fromJson(text) : undefined; + return parseJsonErrorBody(await response.text()); } // Fallback to plain text if content type is not recognized diff --git a/src/core/fetcher/getResponseBody.ts b/src/core/fetcher/getResponseBody.ts index 708d5572..e0b73633 100644 --- a/src/core/fetcher/getResponseBody.ts +++ b/src/core/fetcher/getResponseBody.ts @@ -1,6 +1,37 @@ import { fromJson } from "../json.js"; import { getBinaryResponse } from "./BinaryResponse.js"; +// Pins the upstream Response so undici's FinalizationRegistry can't GC it and cancel the body stream. +function retainResponse(target: object, response: Response): void { + Object.defineProperty(target, "__fern_response_ref", { + value: response, + enumerable: false, + configurable: true, + writable: false, + }); +} + +export type ResponseBodyError = { + ok: false; + error: { reason: "non-json"; statusCode: number; rawBody: string } | { reason: "body-is-null"; statusCode: number }; +}; + +const responseBodyErrors = new WeakSet(); + +function responseBodyError(error: ResponseBodyError["error"]): ResponseBodyError { + const record: ResponseBodyError = { ok: false, error }; + responseBodyErrors.add(record); + return record; +} + +/** + * Returns true when `value` is a failure record created by `getResponseBody` (for example malformed JSON), + * as opposed to a parsed JSON body that happens to have the same shape. + */ +export function isResponseBodyError(value: unknown): value is ResponseBodyError { + return typeof value === "object" && value != null && responseBodyErrors.has(value); +} + export async function getResponseBody(response: Response, responseType?: string): Promise { switch (responseType) { case "binary-response": @@ -11,26 +42,22 @@ export async function getResponseBody(response: Response, responseType?: string) return await response.arrayBuffer(); case "sse": if (response.body == null) { - return { - ok: false, - error: { - reason: "body-is-null", - statusCode: response.status, - }, - }; + return responseBodyError({ + reason: "body-is-null", + statusCode: response.status, + }); } + retainResponse(response.body, response); return response.body; case "streaming": if (response.body == null) { - return { - ok: false, - error: { - reason: "body-is-null", - statusCode: response.status, - }, - }; + return responseBodyError({ + reason: "body-is-null", + statusCode: response.status, + }); } + retainResponse(response.body, response); return response.body; case "text": @@ -44,14 +71,11 @@ export async function getResponseBody(response: Response, responseType?: string) const responseBody = fromJson(text); return responseBody; } catch (_err) { - return { - ok: false, - error: { - reason: "non-json", - statusCode: response.status, - rawBody: text, - }, - }; + return responseBodyError({ + reason: "non-json", + statusCode: response.status, + rawBody: text, + }); } } return undefined; diff --git a/src/core/fetcher/index.ts b/src/core/fetcher/index.ts index c3bc6da2..bd5db362 100644 --- a/src/core/fetcher/index.ts +++ b/src/core/fetcher/index.ts @@ -6,6 +6,8 @@ export type { Fetcher, FetchFunction } from "./Fetcher.js"; export { fetcher } from "./Fetcher.js"; export { getHeader } from "./getHeader.js"; export { HttpResponsePromise } from "./HttpResponsePromise.js"; +export type { PassthroughRequest } from "./makePassthroughRequest.js"; +export { makePassthroughRequest } from "./makePassthroughRequest.js"; export type { RawResponse, WithRawResponse } from "./RawResponse.js"; export { abortRawResponse, toRawResponse, unknownRawResponse } from "./RawResponse.js"; export { Supplier } from "./Supplier.js"; diff --git a/src/core/fetcher/makePassthroughRequest.ts b/src/core/fetcher/makePassthroughRequest.ts new file mode 100644 index 00000000..140f1acb --- /dev/null +++ b/src/core/fetcher/makePassthroughRequest.ts @@ -0,0 +1,228 @@ +import { createLogger, type LogConfig, type Logger } from "../logging/logger.js"; +import { join } from "../url/join.js"; +import { EndpointSupplier } from "./EndpointSupplier.js"; +import { getFetchFn } from "./getFetchFn.js"; +import { makeRequest } from "./makeRequest.js"; +import { redactUrl } from "./redactUrl.js"; +import { requestWithRetries } from "./requestWithRetries.js"; +import { Supplier } from "./Supplier.js"; +import { TIMEOUT } from "./signals.js"; + +export declare namespace PassthroughRequest { + /** + * Per-request options that can override the SDK client defaults. + */ + export interface RequestOptions { + /** Override the default timeout for this request (in seconds). */ + timeoutInSeconds?: number; + /** Override the default number of retries for this request. */ + maxRetries?: number; + /** Additional headers to include in this request. */ + headers?: Record; + /** Abort signal for this request. */ + abortSignal?: AbortSignal; + } + + /** + * SDK client configuration used by the passthrough fetch method. + */ + export interface ClientOptions { + /** The base URL or environment for the client. */ + environment?: Supplier; + /** Override the base URL. */ + baseUrl?: Supplier; + /** Default headers to include in requests. */ + headers?: Record; + /** Default maximum time to wait for a response in seconds. */ + timeoutInSeconds?: number; + /** Default number of times to retry the request. Defaults to 2. */ + maxRetries?: number; + /** A custom fetch function. */ + fetch?: typeof fetch; + /** Logging configuration. */ + logging?: LogConfig | Logger; + /** A function that returns auth headers. */ + getAuthHeaders?: () => Promise>; + } +} + +/** + * Makes a passthrough HTTP request using the SDK's configuration (auth, retry, logging, etc.) + * while mimicking the standard `fetch` API. + * + * @param input - The URL, path, or Request object. If a relative path, it will be resolved against the configured base URL. + * @param init - Standard RequestInit options (method, headers, body, signal, etc.) + * @param clientOptions - SDK client options (auth, default headers, logging, etc.) + * @param requestOptions - Per-request overrides (timeout, retries, extra headers, abort signal). + * @returns A standard Response object. + */ +export async function makePassthroughRequest( + input: Request | string | URL, + init: RequestInit | undefined, + clientOptions: PassthroughRequest.ClientOptions, + requestOptions?: PassthroughRequest.RequestOptions, +): Promise { + const logger = createLogger(clientOptions.logging); + + // Extract URL and default init properties from Request object if provided + let url: string; + let effectiveInit: RequestInit | undefined = init; + if (input instanceof Request) { + url = input.url; + // If no explicit init provided, extract properties from the Request object + if (init == null) { + effectiveInit = { + method: input.method, + headers: Object.fromEntries(input.headers.entries()), + body: input.body, + signal: input.signal, + credentials: input.credentials, + cache: input.cache as RequestCache, + redirect: input.redirect, + referrer: input.referrer, + integrity: input.integrity, + mode: input.mode, + }; + } + } else { + url = input instanceof URL ? input.toString() : input; + } + + // Resolve the base URL + const baseUrl = + (clientOptions.baseUrl != null ? await Supplier.get(clientOptions.baseUrl) : undefined) ?? + (clientOptions.environment != null ? await Supplier.get(clientOptions.environment) : undefined); + + // Determine the full URL + let fullUrl: string; + if (url.startsWith("http://") || url.startsWith("https://")) { + fullUrl = url; + } else if (baseUrl != null) { + fullUrl = join(baseUrl, url); + } else { + fullUrl = url; + } + + // Merge headers: SDK default headers -> auth headers -> user-provided headers + const mergedHeaders: Record = {}; + + // Apply SDK default headers (resolve suppliers) + if (clientOptions.headers != null) { + for (const [key, value] of Object.entries(clientOptions.headers)) { + const resolved = await EndpointSupplier.get(value, { endpointMetadata: {} }); + if (resolved != null) { + mergedHeaders[key.toLowerCase()] = `${resolved}`; + } + } + } + + // Apply auth headers, but only when the resolved URL targets the configured base URL. + // This prevents the SDK's credentials from leaking to an unrelated host when a caller + // passes an absolute cross-origin URL into the passthrough fetch escape hatch. + if (clientOptions.getAuthHeaders != null && targetsBaseUrl(fullUrl, baseUrl)) { + const authHeaders = await clientOptions.getAuthHeaders(); + for (const [key, value] of Object.entries(authHeaders)) { + mergedHeaders[key.toLowerCase()] = value; + } + } + + // Apply user-provided headers from init + if (effectiveInit?.headers != null) { + const initHeaders = + effectiveInit.headers instanceof Headers + ? Object.fromEntries(effectiveInit.headers.entries()) + : Array.isArray(effectiveInit.headers) + ? Object.fromEntries(effectiveInit.headers) + : effectiveInit.headers; + for (const [key, value] of Object.entries(initHeaders)) { + if (value != null) { + mergedHeaders[key.toLowerCase()] = value; + } + } + } + + // Apply per-request option headers (highest priority) + if (requestOptions?.headers != null) { + for (const [key, value] of Object.entries(requestOptions.headers)) { + mergedHeaders[key.toLowerCase()] = value; + } + } + + const method = effectiveInit?.method ?? "GET"; + const body = effectiveInit?.body; + const timeoutInSeconds = requestOptions?.timeoutInSeconds ?? clientOptions.timeoutInSeconds; + const timeoutMs = timeoutInSeconds != null ? timeoutInSeconds * 1000 : undefined; + const maxRetries = requestOptions?.maxRetries ?? clientOptions.maxRetries; + const abortSignal = requestOptions?.abortSignal ?? effectiveInit?.signal ?? undefined; + const fetchFn = clientOptions.fetch ?? (await getFetchFn()); + + if (logger.isDebug()) { + logger.debug("Making passthrough HTTP request", { + method, + url: redactUrl(fullUrl), + hasBody: body != null, + }); + } + + let response: Response; + try { + response = await requestWithRetries( + async () => + makeRequest( + fetchFn, + fullUrl, + method, + mergedHeaders, + body ?? undefined, + timeoutMs, + abortSignal, + effectiveInit?.credentials === "include", + undefined, // duplex + false, // disableCache + ), + maxRetries, + abortSignal, + ); + } catch (error) { + // Match `fetch`: a timeout rejects with an Error named "TimeoutError", not the bare abort reason. + if (error === TIMEOUT) { + throw createTimeoutError(); + } + throw error; + } + + if (logger.isDebug()) { + logger.debug("Passthrough HTTP request completed", { + method, + url: redactUrl(fullUrl), + statusCode: response.status, + }); + } + + return response; +} + +function createTimeoutError(): Error { + const error = new Error("The request timed out."); + error.name = "TimeoutError"; + return error; +} + +/** + * Returns true when the resolved request URL points at the same origin as the + * configured base URL. Relative paths are always joined onto the base URL, so + * they resolve to the base origin and return true. Absolute URLs only match when + * their origin equals the base origin. When there is no base URL to compare + * against, or either value is not a parseable absolute URL, this returns false so + * auth headers are not attached. + */ +function targetsBaseUrl(fullUrl: string, baseUrl: string | undefined): boolean { + if (baseUrl == null) { + return false; + } + try { + return new URL(fullUrl).origin === new URL(baseUrl).origin; + } catch { + return false; + } +} diff --git a/src/core/fetcher/makeRequest.ts b/src/core/fetcher/makeRequest.ts index 921565eb..62ff9fcc 100644 --- a/src/core/fetcher/makeRequest.ts +++ b/src/core/fetcher/makeRequest.ts @@ -1,4 +1,44 @@ -import { anySignal, getTimeoutSignal } from "./signals.js"; +import { anySignal, getTimeoutSignal, TIMEOUT } from "./signals.js"; + +/** + * Cached result of checking whether the current runtime supports + * the `cache` option in `Request`. Some runtimes (e.g. Cloudflare Workers) + * throw a TypeError when this option is used. + */ +let _cacheNoStoreSupported: boolean | undefined; +export function isCacheNoStoreSupported(): boolean { + if (_cacheNoStoreSupported != null) { + return _cacheNoStoreSupported; + } + try { + new Request("http://localhost", { cache: "no-store" }); + _cacheNoStoreSupported = true; + } catch { + _cacheNoStoreSupported = false; + } + return _cacheNoStoreSupported; +} + +/** + * Reset the cached result of `isCacheNoStoreSupported`. Exposed for testing only. + */ +export function resetCacheNoStoreSupported(): void { + _cacheNoStoreSupported = undefined; +} + +const responseTimeouts = new WeakMap>(); + +/** + * Clears the timeout that `makeRequest` kept running (with `keepTimeoutUntilBodyRead`) so that it also + * covered reading the response body. + */ +export function clearResponseTimeout(response: Response): void { + const timeoutId = responseTimeouts.get(response); + if (timeoutId != null) { + clearTimeout(timeoutId); + responseTimeouts.delete(response); + } +} export const makeRequest = async ( fetchFn: (url: string, init: RequestInit) => Promise, @@ -10,13 +50,17 @@ export const makeRequest = async ( abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half", + disableCache?: boolean, + keepTimeoutUntilBodyRead?: boolean, ): Promise => { const signals: AbortSignal[] = []; let timeoutAbortId: ReturnType | undefined; + let timeoutSignal: AbortSignal | undefined; if (timeoutMs != null) { const { signal, abortId } = getTimeoutSignal(timeoutMs); timeoutAbortId = abortId; + timeoutSignal = signal; signals.push(signal); } @@ -24,18 +68,35 @@ export const makeRequest = async ( signals.push(abortSignal); } const newSignals = anySignal(signals); - const response = await fetchFn(url, { - method: method, - headers, - body: requestBody, - signal: newSignals, - credentials: withCredentials ? "include" : undefined, - // @ts-ignore - duplex, - }); + let response: Response; + try { + response = await fetchFn(url, { + method: method, + headers, + body: requestBody, + signal: newSignals, + credentials: withCredentials ? "include" : undefined, + // @ts-ignore + duplex, + ...(disableCache && isCacheNoStoreSupported() ? { cache: "no-store" as RequestCache } : {}), + }); + } catch (error) { + if (timeoutAbortId != null) { + clearTimeout(timeoutAbortId); + } + // Some runtimes (e.g. Node 18) reject with their own error instead of the abort reason. + if (timeoutSignal?.aborted && !abortSignal?.aborted) { + throw TIMEOUT; + } + throw error; + } if (timeoutAbortId != null) { - clearTimeout(timeoutAbortId); + if (keepTimeoutUntilBodyRead) { + responseTimeouts.set(response, timeoutAbortId); + } else { + clearTimeout(timeoutAbortId); + } } return response; diff --git a/src/core/fetcher/redactUrl.ts b/src/core/fetcher/redactUrl.ts new file mode 100644 index 00000000..3c2e897a --- /dev/null +++ b/src/core/fetcher/redactUrl.ts @@ -0,0 +1,102 @@ +export const SENSITIVE_QUERY_PARAMS: Set = new Set([ + "api_key", + "api-key", + "apikey", + "token", + "access_token", + "access-token", + "auth_token", + "auth-token", + "password", + "passwd", + "secret", + "api_secret", + "api-secret", + "apisecret", + "key", + "session", + "session_id", + "session-id", +]); + +export function redactUrl(url: string): string { + const protocolIndex = url.indexOf("://"); + if (protocolIndex === -1) return url; + + const afterProtocol = protocolIndex + 3; + + // Find the first delimiter that marks the end of the authority section + const pathStart = url.indexOf("/", afterProtocol); + let queryStart = url.indexOf("?", afterProtocol); + let fragmentStart = url.indexOf("#", afterProtocol); + + const firstDelimiter = Math.min( + pathStart === -1 ? url.length : pathStart, + queryStart === -1 ? url.length : queryStart, + fragmentStart === -1 ? url.length : fragmentStart, + ); + + // Find the LAST @ before the delimiter (handles multiple @ in credentials) + let atIndex = -1; + for (let i = afterProtocol; i < firstDelimiter; i++) { + if (url[i] === "@") { + atIndex = i; + } + } + + if (atIndex !== -1) { + url = `${url.slice(0, afterProtocol)}[REDACTED]@${url.slice(atIndex + 1)}`; + } + + // Recalculate queryStart since url might have changed + queryStart = url.indexOf("?"); + if (queryStart === -1) return url; + + fragmentStart = url.indexOf("#", queryStart); + const queryEnd = fragmentStart !== -1 ? fragmentStart : url.length; + const queryString = url.slice(queryStart + 1, queryEnd); + + if (queryString.length === 0) return url; + + // FAST PATH: Quick check if any sensitive keywords present + // Using indexOf is faster than regex for simple substring matching + const lower = queryString.toLowerCase(); + const hasSensitive = + lower.includes("token") || + lower.includes("key") || + lower.includes("password") || + lower.includes("passwd") || + lower.includes("secret") || + lower.includes("session") || + lower.includes("auth"); + + if (!hasSensitive) { + return url; + } + + // SLOW PATH: Parse and redact + const redactedParams: string[] = []; + const params = queryString.split("&"); + + for (const param of params) { + const equalIndex = param.indexOf("="); + if (equalIndex === -1) { + redactedParams.push(param); + continue; + } + + const key = param.slice(0, equalIndex); + let shouldRedact = SENSITIVE_QUERY_PARAMS.has(key.toLowerCase()); + + if (!shouldRedact && key.includes("%")) { + try { + const decodedKey = decodeURIComponent(key); + shouldRedact = SENSITIVE_QUERY_PARAMS.has(decodedKey.toLowerCase()); + } catch {} + } + + redactedParams.push(shouldRedact ? `${key}=[REDACTED]` : param); + } + + return url.slice(0, queryStart + 1) + redactedParams.join("&") + url.slice(queryEnd); +} diff --git a/src/core/fetcher/requestWithRetries.ts b/src/core/fetcher/requestWithRetries.ts index 1f689688..eb7c273e 100644 --- a/src/core/fetcher/requestWithRetries.ts +++ b/src/core/fetcher/requestWithRetries.ts @@ -3,6 +3,10 @@ const MAX_RETRY_DELAY = 60000; // in milliseconds const DEFAULT_MAX_RETRIES = 2; const JITTER_FACTOR = 0.2; // 20% random jitter +function isRetryableStatusCode(statusCode: number): boolean { + return [408, 429].includes(statusCode) || statusCode >= 500; +} + function addPositiveJitter(delay: number): number { const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR; return delay * jitterMultiplier; @@ -44,17 +48,40 @@ function getRetryDelayFromHeaders(response: Response, retryAttempt: number): num return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * 2 ** retryAttempt, MAX_RETRY_DELAY)); } +/** + * Waits `ms` milliseconds, or rejects as soon as `abortSignal` aborts. The timer and + * the abort listener are always removed, so a cancelled wait never keeps the process alive. + */ +function sleep(ms: number, abortSignal: AbortSignal | undefined): Promise { + return new Promise((resolve, reject) => { + if (abortSignal?.aborted) { + reject(abortSignal.reason); + return; + } + const onAbort = () => { + clearTimeout(timeoutId); + reject(abortSignal?.reason); + }; + const timeoutId = setTimeout(() => { + abortSignal?.removeEventListener("abort", onAbort); + resolve(); + }, ms); + abortSignal?.addEventListener("abort", onAbort, { once: true }); + }); +} + export async function requestWithRetries( requestFn: () => Promise, maxRetries: number = DEFAULT_MAX_RETRIES, + abortSignal?: AbortSignal, ): Promise { let response: Response = await requestFn(); for (let i = 0; i < maxRetries; ++i) { - if ([408, 429].includes(response.status) || response.status >= 500) { + if (isRetryableStatusCode(response.status)) { const delay = getRetryDelayFromHeaders(response, i); - await new Promise((resolve) => setTimeout(resolve, delay)); + await sleep(delay, abortSignal); response = await requestFn(); } else { break; diff --git a/src/core/fetcher/signals.ts b/src/core/fetcher/signals.ts index 7bd3757e..925527b6 100644 --- a/src/core/fetcher/signals.ts +++ b/src/core/fetcher/signals.ts @@ -1,4 +1,4 @@ -const TIMEOUT = "timeout"; +export const TIMEOUT = "timeout"; export function getTimeoutSignal(timeoutMs: number): { signal: AbortSignal; abortId: ReturnType } { const controller = new AbortController(); @@ -14,12 +14,21 @@ export function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal for (const signal of signals) { if (signal.aborted) { controller.abort((signal as any)?.reason); - break; + return controller.signal; } signal.addEventListener("abort", () => controller.abort((signal as any)?.reason), { signal: controller.signal, }); + + // Re-check after adding listener: the signal may have aborted + // between the initial `signal.aborted` check and the `addEventListener` + // call above. If it did, the abort event was already dispatched and + // the listener will never fire — we must manually abort. + if (signal.aborted) { + controller.abort((signal as any)?.reason); + return controller.signal; + } } return controller.signal; diff --git a/src/core/headers.ts b/src/core/headers.ts index 78ed8b50..be45c455 100644 --- a/src/core/headers.ts +++ b/src/core/headers.ts @@ -1,7 +1,5 @@ -export function mergeHeaders( - ...headersArray: (Record | null | undefined)[] -): Record { - const result: Record = {}; +export function mergeHeaders(...headersArray: (Record | null | undefined)[]): Record { + const result: Record = {}; for (const [key, value] of headersArray .filter((headers) => headers != null) @@ -17,10 +15,10 @@ export function mergeHeaders( return result; } -export function mergeOnlyDefinedHeaders( - ...headersArray: (Record | null | undefined)[] -): Record { - const result: Record = {}; +export function mergeOnlyDefinedHeaders( + ...headersArray: (Record | null | undefined)[] +): Record { + const result: Record = {}; for (const [key, value] of headersArray .filter((headers) => headers != null) diff --git a/src/core/pagination/Page.ts b/src/core/pagination/Page.ts index 6621a6f1..0321a3c0 100644 --- a/src/core/pagination/Page.ts +++ b/src/core/pagination/Page.ts @@ -68,7 +68,7 @@ export class Page implements AsyncIterable { } } - async *[Symbol.asyncIterator](): AsyncIterator { + async *[Symbol.asyncIterator](): AsyncIterator { for await (const message of this.iterMessages()) { yield message; } diff --git a/src/core/requestBody.ts b/src/core/requestBody.ts new file mode 100644 index 00000000..d58ef590 --- /dev/null +++ b/src/core/requestBody.ts @@ -0,0 +1,26 @@ +/** + * Spreads caller-supplied `additionalBodyParameters` (from `requestOptions.additionalBodyParameters`) + * on top of the request body. Caller-supplied properties win over the endpoint body. When no + * additional body parameters are provided, the original body is returned unchanged so serialization + * is unaffected. + * + * The merge only applies to plain-object (JSON object) bodies. When the body is `null`/`undefined` + * the additional parameters become the body; when the body is an array or a primitive JSON value it + * is returned unchanged, since object properties cannot be spread into it. This mirrors the Python + * SDK, which only merges additional body parameters into mapping bodies. + */ +export function mergeAdditionalBodyParameters( + body: unknown, + additionalBodyParameters: Record | undefined, +): unknown { + if (additionalBodyParameters == null) { + return body; + } + if (body == null) { + return { ...additionalBodyParameters }; + } + if (typeof body === "object" && !Array.isArray(body)) { + return { ...body, ...additionalBodyParameters }; + } + return body; +} diff --git a/src/core/runtime/index.ts b/src/core/runtime/index.ts index cfab23f9..85a32720 100644 --- a/src/core/runtime/index.ts +++ b/src/core/runtime/index.ts @@ -1 +1 @@ -export { RUNTIME } from "./runtime.js"; +export { getUserAgent, RUNTIME } from "./runtime.js"; diff --git a/src/core/runtime/runtime.ts b/src/core/runtime/runtime.ts index 56ebbb87..d367ce6b 100644 --- a/src/core/runtime/runtime.ts +++ b/src/core/runtime/runtime.ts @@ -2,6 +2,10 @@ interface DenoGlobal { version: { deno: string; }; + build?: { + os?: string; + arch?: string; + }; } interface BunGlobal { @@ -24,6 +28,18 @@ export interface Runtime { type: "browser" | "web-worker" | "deno" | "bun" | "node" | "react-native" | "unknown" | "workerd" | "edge-runtime"; version?: string; parsedVersion?: number; + /** + * The operating system the SDK is running on, when it can be determined + * (e.g. "linux", "darwin", "win32" on server runtimes). Undefined in + * environments where the OS is not observable (e.g. browsers). + */ + os?: string; + /** + * The CPU architecture the SDK is running on, when it can be determined + * (e.g. "x64", "arm64" on server runtimes). Undefined in environments where + * the architecture is not observable (e.g. browsers). + */ + arch?: string; } function evaluateRuntime(): Runtime { @@ -85,6 +101,8 @@ function evaluateRuntime(): Runtime { return { type: "deno", version: Deno.version.deno, + os: Deno.build?.os, + arch: Deno.build?.arch, }; } @@ -96,6 +114,8 @@ function evaluateRuntime(): Runtime { return { type: "bun", version: Bun.version, + os: typeof process !== "undefined" ? process.platform : undefined, + arch: typeof process !== "undefined" ? process.arch : undefined, }; } @@ -113,18 +133,20 @@ function evaluateRuntime(): Runtime { /** * A constant that indicates whether the environment the code is running is Node.JS. + * + * We assign `process` to a local variable first to avoid being flagged by + * bundlers that perform static analysis on `process.versions` (e.g. Next.js + * Edge Runtime warns about Node.js APIs even when they are guarded). */ - const isNode = - typeof process !== "undefined" && - "version" in process && - !!process.version && - "versions" in process && - !!process.versions?.node; + const _process = typeof process !== "undefined" ? process : undefined; + const isNode = typeof _process !== "undefined" && typeof _process.versions?.node === "string"; if (isNode) { return { type: "node", - version: process.versions.node, - parsedVersion: Number(process.versions.node.split(".")[0]), + version: _process.versions.node, + parsedVersion: Number(_process.versions.node.split(".")[0]), + os: _process.platform, + arch: _process.arch, }; } @@ -132,3 +154,78 @@ function evaluateRuntime(): Runtime { type: "unknown", }; } + +/** + * Display names for the language runtimes whose version is meaningful to encode + * in a User-Agent. Environments where a version string is not useful (e.g. + * browsers, where `version` is the full navigator UA) are intentionally mapped + * to `undefined` so they are omitted from the User-Agent. + */ +const RUNTIME_DISPLAY_NAMES: Record = { + node: "Node", + deno: "Deno", + bun: "Bun", + browser: undefined, + "web-worker": undefined, + "react-native": undefined, + workerd: undefined, + "edge-runtime": undefined, + unknown: undefined, +}; + +/** + * CPU architecture aliases that all refer to 64-bit x86. They are normalized to + * the single canonical token `x86_64` so the User-Agent architecture label is + * consistent regardless of which runtime reports it (Node reports `x64`, others + * report `amd64` or `x86_64`). + */ +const X86_64_ARCH_ALIASES = new Set(["x64", "amd64", "x86_64"]); + +/** + * Normalizes a CPU architecture token, collapsing the 64-bit x86 aliases + * (`x64`, `amd64`, `x86_64`) to `x86_64`. Other architectures are returned + * unchanged. + */ +function normalizeArch(arch: string | undefined): string | undefined { + if (arch == null) { + return arch; + } + return X86_64_ARCH_ALIASES.has(arch.toLowerCase()) ? "x86_64" : arch; +} + +/** + * Percent-encodes the `@` and `/` characters in an npm package name so the + * User-Agent product token stays within the RFC 7230 token grammar. The + * original scoped package name can be recovered by URL-decoding (e.g. + * `@dummy/sdk` becomes `%40dummy%2Fsdk`). + */ +function encodeProductName(sdkName: string): string { + return sdkName.replace(/@/g, "%40").replace(/\//g, "%2F"); +} + +/** + * Builds a structured User-Agent string of the form + * `{sdkName}/{sdkVersion} ({os}; {arch}) {runtime}/{runtimeVersion}` + * where the platform group and runtime segment are omitted gracefully when the + * underlying values cannot be determined (e.g. in a browser). + */ +export function getUserAgent(sdkName: string, sdkVersion: string): string { + let userAgent = `${encodeProductName(sdkName)}/${sdkVersion}`; + + const platform = [RUNTIME.os, normalizeArch(RUNTIME.arch)].filter( + (part): part is string => part != null && part.length > 0, + ); + if (platform.length > 0) { + userAgent += ` (${platform.join("; ")})`; + } + + const runtimeName = RUNTIME_DISPLAY_NAMES[RUNTIME.type]; + if (runtimeName != null) { + userAgent += ` ${runtimeName}`; + if (RUNTIME.version != null && RUNTIME.version.length > 0) { + userAgent += `/${RUNTIME.version}`; + } + } + + return userAgent; +} diff --git a/src/core/url/QueryStringBuilder.ts b/src/core/url/QueryStringBuilder.ts new file mode 100644 index 00000000..b045221c --- /dev/null +++ b/src/core/url/QueryStringBuilder.ts @@ -0,0 +1,87 @@ +import { toQueryString } from "./qs.js"; + +/** + * Creates a fluent builder for constructing URL query strings. + * + * Each `.add()` call serializes its value immediately (like C#'s builder), + * so no format tracking is needed — the style is applied at add-time. + * + * Usage (generated code): + * + * const qs = core.url.queryBuilder() + * .add("limit", limit) + * .add("tags", tags, { style: "comma" }) // explode: false + * .mergeAdditional(requestOptions?.queryParams) + * .build(); + */ +export function queryBuilder(): QueryStringBuilder { + return new QueryStringBuilder(); +} + +class QueryStringBuilder { + private parts: Map = new Map(); + + /** + * Adds a query parameter, serializing it immediately. + * + * By default arrays use "repeat" format (`key=a&key=b`). + * Pass `{ style: "comma" }` for OpenAPI `explode: false` parameters + * to get comma-separated values (`key=a,b,c`). + * + * Null / undefined values are silently skipped. + */ + add(key: string, value: unknown, options?: { style?: "comma" }): this { + if (value === undefined || value === null) { + return this; + } + const serialized = toQueryString( + { [key]: value }, + { arrayFormat: options?.style === "comma" ? "comma" : "repeat" }, + ); + if (serialized.length > 0) { + this.parts.set(key, serialized); + } + return this; + } + + /** + * Adds multiple query parameters at once from a record. + * All parameters use the default "repeat" array format. + * Null / undefined values are silently skipped. + */ + addMany(params: Record): this { + if (params != null) { + for (const [key, value] of Object.entries(params)) { + this.add(key, value); + } + } + return this; + } + + /** + * Merges additional query parameters supplied at call-time via + * `requestOptions.queryParams`. Overrides existing keys (last-write-wins). + */ + mergeAdditional(additionalParams?: Record): this { + if (additionalParams != null) { + for (const [key, value] of Object.entries(additionalParams)) { + if (value === undefined || value === null) { + continue; + } + const serialized = toQueryString({ [key]: value }, { arrayFormat: "repeat" }); + if (serialized.length > 0) { + this.parts.set(key, serialized); + } + } + } + return this; + } + + /** + * Returns the assembled query string (without the leading `?`). + * Returns an empty string when no parameters were added. + */ + build(): string { + return [...this.parts.values()].join("&"); + } +} diff --git a/src/core/url/encodePathParam.ts b/src/core/url/encodePathParam.ts index 19b90124..052f1dfc 100644 --- a/src/core/url/encodePathParam.ts +++ b/src/core/url/encodePathParam.ts @@ -1,4 +1,7 @@ -export function encodePathParam(param: unknown): string { +export function encodePathParam( + param: unknown, + InvalidPathParameterError?: new (args: { message: string }) => Error, +): string { if (param === null) { return "null"; } @@ -14,5 +17,11 @@ export function encodePathParam(param: unknown): string { param = String(param); break; } - return encodeURIComponent(param as string | number | boolean); + const encoded = encodeURIComponent(param as string | number | boolean); + // "." and ".." are dot segments: URL resolution would remove them and send the request to a different path. + if (encoded === "." || encoded === "..") { + const message = `Invalid path parameter "${encoded}": "." and ".." are not allowed because they change the request path.`; + throw InvalidPathParameterError != null ? new InvalidPathParameterError({ message }) : new Error(message); + } + return encoded; } diff --git a/src/core/url/index.ts b/src/core/url/index.ts index f2e0fa2d..ca9d4fbd 100644 --- a/src/core/url/index.ts +++ b/src/core/url/index.ts @@ -1,3 +1,4 @@ export { encodePathParam } from "./encodePathParam.js"; export { join } from "./join.js"; +export { queryBuilder } from "./QueryStringBuilder.js"; export { toQueryString } from "./qs.js"; diff --git a/src/core/url/qs.ts b/src/core/url/qs.ts index 13e89be9..aebb95a3 100644 --- a/src/core/url/qs.ts +++ b/src/core/url/qs.ts @@ -1,5 +1,7 @@ +type ArrayFormat = "indices" | "repeat" | "comma"; + interface QueryStringOptions { - arrayFormat?: "indices" | "repeat"; + arrayFormat?: ArrayFormat; encode?: boolean; } @@ -25,7 +27,7 @@ function stringifyObject(obj: Record, prefix = "", options: Req for (const [key, value] of Object.entries(obj)) { const fullKey = prefix ? `${prefix}[${key}]` : key; - if (value === undefined) { + if (value == null) { continue; } @@ -33,18 +35,29 @@ function stringifyObject(obj: Record, prefix = "", options: Req if (value.length === 0) { continue; } - for (let i = 0; i < value.length; i++) { - const item = value[i]; - if (item === undefined) { - continue; + const effectiveFormat = options.arrayFormat; + if (effectiveFormat === "comma") { + const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey; + const encodedValues = value + .filter((item) => item !== undefined && item !== null) + .map((item) => encodeValue(item, options.encode)); + if (encodedValues.length > 0) { + parts.push(`${encodedKey}=${encodedValues.join(",")}`); } - if (typeof item === "object" && !Array.isArray(item) && item !== null) { - const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey; - parts.push(...stringifyObject(item as Record, arrayKey, options)); - } else { - const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey; - const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey; - parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`); + } else { + for (let i = 0; i < value.length; i++) { + const item = value[i]; + if (item == null) { + continue; + } + if (typeof item === "object" && !Array.isArray(item) && item !== null) { + const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey; + parts.push(...stringifyObject(item as Record, arrayKey, options)); + } else { + const arrayKey = effectiveFormat === "indices" ? `${fullKey}[${i}]` : fullKey; + const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey; + parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`); + } } } } else if (typeof value === "object" && value !== null) { diff --git a/src/core/utils/setObjectProperty.ts b/src/core/utils/setObjectProperty.ts index 5528af24..9daac39e 100644 --- a/src/core/utils/setObjectProperty.ts +++ b/src/core/utils/setObjectProperty.ts @@ -1,12 +1,13 @@ /** - * Sets the value at path of object. If a portion of path doesn’t exist it’s created. This is - * inspired by Lodash's set function, but is simplified to accommodate our use case. - * For more details, see https://lodash.com/docs/4.17.15#set. + * Returns a copy of object with the value at path set. If a portion of path doesn’t exist it’s created. + * Each object along path is shallow-copied, so the original object (and any nested objects it + * shares with the copy) is never modified. This is inspired by Lodash's set function, but is + * simplified to accommodate our use case. For more details, see https://lodash.com/docs/4.17.15#set. * - * @param object The object to modify. + * @param object The object to copy. * @param path The path of the property to set. * @param value The value to set. - * @return Returns object. + * @return Returns the updated copy of object. */ export function setObjectProperty(object: T, path: string, value: any): T { if (object == null) { @@ -19,15 +20,19 @@ export function setObjectProperty(object: T, path: string, val return object; } - let current: Record = object; + const result: Record = { ...object }; + let current: Record = result; for (let i = 0; i < keys.length - 1; i++) { const key = keys[i]; if (key == null) { // Unreachable. continue; } - if (!current[key] || typeof current[key] !== "object") { - current[key] = {}; + const next = current[key]; + if (Array.isArray(next)) { + current[key] = [...next]; + } else { + current[key] = next != null && typeof next === "object" ? { ...next } : {}; } current = current[key] as Record; } @@ -35,9 +40,9 @@ export function setObjectProperty(object: T, path: string, val const lastKey = keys[keys.length - 1]; if (lastKey == null) { // Unreachable. - return object; + return result as T; } current[lastKey] = value; - return object; + return result as T; } diff --git a/src/errors/IntercomError.ts b/src/errors/IntercomError.ts index de63f5e0..2bab808f 100644 --- a/src/errors/IntercomError.ts +++ b/src/errors/IntercomError.ts @@ -7,23 +7,52 @@ export class IntercomError extends Error { public readonly statusCode?: number; public readonly body?: unknown; public readonly rawResponse?: core.RawResponse; + public readonly cause?: unknown; constructor({ message, statusCode, body, rawResponse, + cause, }: { message?: string; statusCode?: number; body?: unknown; rawResponse?: core.RawResponse; + cause?: unknown; }) { super(buildMessage({ message, statusCode, body })); - Object.setPrototypeOf(this, IntercomError.prototype); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "IntercomError"; this.statusCode = statusCode; this.body = body; this.rawResponse = rawResponse; + if (cause != null) { + this.cause = cause; + } + } + + public get requestId(): string | undefined { + const headers = this.rawResponse?.headers; + if (headers == null) { + return undefined; + } + const requestId = headers.get("X-Request-Id"); + if (requestId != null) { + return requestId; + } + let fallback: string | undefined; + headers.forEach((value, name) => { + if (fallback === undefined && /request[-_]?id$/i.test(name)) { + fallback = value; + } + }); + return fallback; } } diff --git a/src/errors/IntercomTimeoutError.ts b/src/errors/IntercomTimeoutError.ts index e0c388db..f68305d8 100644 --- a/src/errors/IntercomTimeoutError.ts +++ b/src/errors/IntercomTimeoutError.ts @@ -1,8 +1,18 @@ // This file was auto-generated by Fern from our API Definition. -export class IntercomTimeoutError extends Error { - constructor(message: string) { - super(message); - Object.setPrototypeOf(this, IntercomTimeoutError.prototype); +import * as errors from "./index.js"; + +export class IntercomTimeoutError extends errors.IntercomError { + constructor(message: string, opts?: { cause?: unknown }) { + super({ + message: message, + cause: opts?.cause, + }); + Object.setPrototypeOf(this, new.target.prototype); + if (Error.captureStackTrace) { + Error.captureStackTrace(this, this.constructor); + } + + this.name = "IntercomTimeoutError"; } } diff --git a/src/errors/handleNonStatusCodeError.ts b/src/errors/handleNonStatusCodeError.ts index 75076b10..28727d8c 100644 --- a/src/errors/handleNonStatusCodeError.ts +++ b/src/errors/handleNonStatusCodeError.ts @@ -22,11 +22,14 @@ export function handleNonStatusCodeError( rawResponse: rawResponse, }); case "timeout": - throw new errors.IntercomTimeoutError(`Timeout exceeded when calling ${method} ${path}.`); + throw new errors.IntercomTimeoutError(`Timeout exceeded when calling ${method} ${path}.`, { + cause: error.cause, + }); case "unknown": throw new errors.IntercomError({ message: error.errorMessage, rawResponse: rawResponse, + cause: error.cause, }); default: throw new errors.IntercomError({ diff --git a/src/version.ts b/src/version.ts index 948f7433..07bfe918 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const SDK_VERSION = "7.0.3"; +export const SDK_VERSION = "7.1.0"; diff --git a/tests/integration/articles.test.ts b/tests/integration/articles.test.ts index d7e0dc2d..231a30a1 100644 --- a/tests/integration/articles.test.ts +++ b/tests/integration/articles.test.ts @@ -1,6 +1,6 @@ -import { IntercomClient as Client } from "../../src"; -import { randomString } from "./utils/random"; +import type { IntercomClient as Client } from "../../src"; import { createClient } from "./utils/createClient"; +import { randomString } from "./utils/random"; async function createArticle(client: Client, parentId: number, adminId: number) { return await client.articles.create({ diff --git a/tests/integration/companies.test.ts b/tests/integration/companies.test.ts index 078d81ee..4363f9f1 100644 --- a/tests/integration/companies.test.ts +++ b/tests/integration/companies.test.ts @@ -1,7 +1,7 @@ -import { Intercom } from "../../src"; -import { dateToUnixTimestamp } from "./utils/date"; +import type { Intercom } from "../../src"; import { createCompany, tryDeleteCompany } from "./helpers"; import { createClient } from "./utils/createClient"; +import { dateToUnixTimestamp } from "./utils/date"; describe("Companies", () => { let contactId: string; diff --git a/tests/integration/contacts.test.ts b/tests/integration/contacts.test.ts index 633714dc..d5a1c8b4 100644 --- a/tests/integration/contacts.test.ts +++ b/tests/integration/contacts.test.ts @@ -1,8 +1,8 @@ -import { Intercom } from "../../src"; -import { dateToUnixTimestamp } from "./utils/date"; -import { randomString } from "./utils/random"; +import type { Intercom } from "../../src"; import { createContact, tryDeleteCompany, tryDeleteContact, tryUntagContact } from "./helpers"; import { createClient } from "./utils/createClient"; +import { dateToUnixTimestamp } from "./utils/date"; +import { randomString } from "./utils/random"; describe("Contacts", () => { let subscriptionId: string; diff --git a/tests/integration/conversations.test.ts b/tests/integration/conversations.test.ts index fed0a9b9..a2e10109 100644 --- a/tests/integration/conversations.test.ts +++ b/tests/integration/conversations.test.ts @@ -1,4 +1,4 @@ -import { Intercom } from "../../src"; +import type { Intercom } from "../../src"; import { createConversation, tryDeleteContact } from "./helpers"; import { createClient } from "./utils/createClient"; import { randomString } from "./utils/random"; @@ -12,7 +12,7 @@ describe("Conversations", () => { let adminId: string; let secondAdminId: string; let conversationId: string; - let conversation: Intercom.Conversation; + let _conversation: Intercom.Conversation; const client = createClient(); @@ -49,7 +49,7 @@ describe("Conversations", () => { // Give Intercom a few seconds to index conversation await wait(5000); - conversation = await client.conversations.find({ + _conversation = await client.conversations.find({ conversation_id: conversationId, }); }, 20_000); @@ -124,7 +124,7 @@ describe("Conversations", () => { type: "admin", body: "test", admin_id: adminId, - } + }, }); // assert @@ -140,7 +140,7 @@ describe("Conversations", () => { type: "user", body: "*click* Nice!", intercom_user_id: user.id, - } + }, }); // assert @@ -160,7 +160,7 @@ describe("Conversations", () => { admin_id: adminId, assignee_id: secondAdminId, body: "Goodbye :)", - } + }, }); // assert @@ -189,7 +189,7 @@ describe("Conversations", () => { message_type: "snoozed", admin_id: adminId, snoozed_until: new Date("2040.06.19").getTime() / 1000, - } + }, }); // assert @@ -203,7 +203,7 @@ describe("Conversations", () => { body: { message_type: "open", admin_id: adminId, - } + }, }); // assert @@ -260,7 +260,7 @@ describe("Conversations", () => { message_type: "close", admin_id: adminId, body: "Hasta la vista, baby", - } + }, }); // assert diff --git a/tests/integration/dataAttributes.test.ts b/tests/integration/dataAttributes.test.ts index f5889fa2..6e8132bb 100644 --- a/tests/integration/dataAttributes.test.ts +++ b/tests/integration/dataAttributes.test.ts @@ -1,6 +1,6 @@ -import { Intercom } from "../../src"; -import { randomString } from "./utils/random"; +import type { Intercom } from "../../src"; import { createClient } from "./utils/createClient"; +import { randomString } from "./utils/random"; describe("Data Attributes", () => { let randomDataAttribute: Intercom.DataAttribute | undefined; diff --git a/tests/integration/dataExport.test.ts b/tests/integration/dataExport.test.ts index a26d014a..25e10b35 100644 --- a/tests/integration/dataExport.test.ts +++ b/tests/integration/dataExport.test.ts @@ -1,4 +1,4 @@ -import { Intercom, IntercomClient } from "../../src"; +import type { Intercom, IntercomClient } from "../../src"; import { createClient } from "./utils/createClient"; async function createDataExport(client: IntercomClient): Promise { diff --git a/tests/integration/events.test.ts b/tests/integration/events.test.ts index d86c25c9..6e2896a1 100644 --- a/tests/integration/events.test.ts +++ b/tests/integration/events.test.ts @@ -1,11 +1,10 @@ -import { IntercomClient as Client } from "../../src"; +import { createClient } from "./utils/createClient"; import { dateToUnixTimestamp } from "./utils/date"; import { randomString } from "./utils/random"; -import { createClient } from "./utils/createClient"; describe("Events", () => { let userId: string; - let eventId = randomString(); + const eventId = randomString(); const client = createClient(); @@ -51,7 +50,7 @@ describe("Events", () => { wereall: "gonna make it", price: "9001", }, - }) + }), ).not.toThrowError(); }); diff --git a/tests/integration/helpCenter/collections.test.ts b/tests/integration/helpCenter/collections.test.ts index 6dcfd781..d85ba63e 100644 --- a/tests/integration/helpCenter/collections.test.ts +++ b/tests/integration/helpCenter/collections.test.ts @@ -1,5 +1,5 @@ -import { IntercomClient as Client } from "../../../src"; -import { Collection } from "../../../src/api/resources/helpCenter/types"; +import type { IntercomClient as Client } from "../../../src"; +import type { Collection } from "../../../src/api/resources/helpCenter/types"; import { createClient } from "../utils/createClient"; async function createCollection(client: Client): Promise { diff --git a/tests/integration/helpers.ts b/tests/integration/helpers.ts index 0d358442..cda1b0b5 100644 --- a/tests/integration/helpers.ts +++ b/tests/integration/helpers.ts @@ -1,4 +1,4 @@ -import { Intercom, IntercomClient } from "../../src"; +import type { Intercom, IntercomClient } from "../../src"; import { dateToUnixTimestamp } from "./utils/date"; import { randomString } from "./utils/random"; @@ -66,7 +66,7 @@ export async function tryUntagConversation( client: IntercomClient, conversationId: string, tagId: string, - adminId: string + adminId: string, ) { try { await client.tags.untagConversation({ conversation_id: conversationId, tag_id: tagId, admin_id: adminId }); diff --git a/tests/integration/integration.test.ts b/tests/integration/integration.test.ts index 321552f6..3a08d74d 100644 --- a/tests/integration/integration.test.ts +++ b/tests/integration/integration.test.ts @@ -1,7 +1,7 @@ -import { Intercom } from "../../src"; -import { randomString } from "./utils/random"; +import type { Intercom } from "../../src"; import { createCompany, tryDeleteCompany, tryDeleteContact, tryDeleteTag } from "./helpers"; import { createClient } from "./utils/createClient"; +import { randomString } from "./utils/random"; describe("Integration between Contact, Conversation, Company and Tag APIs", () => { let adminId: string; diff --git a/tests/integration/messages.test.ts b/tests/integration/messages.test.ts index e1bd716b..bc630a17 100644 --- a/tests/integration/messages.test.ts +++ b/tests/integration/messages.test.ts @@ -1,8 +1,8 @@ -import { Intercom } from "../../src"; +import type { Intercom } from "../../src"; import { tryDeleteContact } from "./helpers"; +import { createClient } from "./utils/createClient"; import { randomString } from "./utils/random"; import { wait } from "./utils/wait"; -import { createClient } from "./utils/createClient"; describe("Messages", () => { let adminId: string; diff --git a/tests/integration/notes.test.ts b/tests/integration/notes.test.ts index b38c17ff..34e02d27 100644 --- a/tests/integration/notes.test.ts +++ b/tests/integration/notes.test.ts @@ -1,7 +1,7 @@ -import { Intercom } from "../../src"; +import type { Intercom } from "../../src"; import { tryDeleteContact } from "./helpers"; -import { randomString } from "./utils/random"; import { createClient } from "./utils/createClient"; +import { randomString } from "./utils/random"; describe("Notes", () => { let adminId: string; diff --git a/tests/integration/pagination.test.ts b/tests/integration/pagination.test.ts index 07112d63..cf1e8a43 100644 --- a/tests/integration/pagination.test.ts +++ b/tests/integration/pagination.test.ts @@ -1,8 +1,8 @@ -import { Companies } from "../../src/api/resources/companies/client/Client"; -import { Contacts } from "../../src/api/resources/contacts/client/Client"; -import { Conversations } from "../../src/api/resources/conversations/client/Client"; -import { Collections } from "../../src/api/resources/helpCenters/resources/collections/client/Client"; -import { Notes } from "../../src/api/resources/notes/client/Client"; +import type { Companies } from "../../src/api/resources/companies/client/Client"; +import type { Contacts } from "../../src/api/resources/contacts/client/Client"; +import type { Conversations } from "../../src/api/resources/conversations/client/Client"; +import type { Collections } from "../../src/api/resources/helpCenters/resources/collections/client/Client"; +import type { Notes } from "../../src/api/resources/notes/client/Client"; import { createClient } from "./utils/createClient"; import { randomString } from "./utils/random"; diff --git a/tests/integration/tags.test.ts b/tests/integration/tags.test.ts index f4fa85c5..35ebc1f8 100644 --- a/tests/integration/tags.test.ts +++ b/tests/integration/tags.test.ts @@ -1,18 +1,17 @@ -import { Intercom } from "../../src"; +import type { Intercom } from "../../src"; import { - tryDeleteTag, + createCompany, createContact, - tryDeleteContact, createConversation, tryDeleteCompany, - createCompany, + tryDeleteContact, + tryDeleteTag, + tryUntagCompany, tryUntagContact, tryUntagConversation, - tryUntagCompany, } from "./helpers"; import { createClient } from "./utils/createClient"; import { randomString } from "./utils/random"; -import { wait } from "./utils/wait"; describe("Tags", () => { let adminId: string; diff --git a/tests/unit/auth/BasicAuth.test.ts b/tests/unit/auth/BasicAuth.test.ts index 9b512336..8c82c1b7 100644 --- a/tests/unit/auth/BasicAuth.test.ts +++ b/tests/unit/auth/BasicAuth.test.ts @@ -3,8 +3,8 @@ import { BasicAuth } from "../../../src/core/auth/BasicAuth"; describe("BasicAuth", () => { interface ToHeaderTestCase { description: string; - input: { username: string; password: string }; - expected: string; + input: { username?: string; password?: string }; + expected: string | undefined; } interface FromHeaderTestCase { @@ -22,10 +22,30 @@ describe("BasicAuth", () => { describe("toAuthorizationHeader", () => { const toHeaderTests: ToHeaderTestCase[] = [ { - description: "correctly converts to header", + description: "correctly converts to header with both username and password", input: { username: "username", password: "password" }, expected: "Basic dXNlcm5hbWU6cGFzc3dvcmQ=", }, + { + description: "encodes username only with trailing colon", + input: { username: "username" }, + expected: "Basic dXNlcm5hbWU6", + }, + { + description: "encodes password only with leading colon", + input: { password: "password" }, + expected: "Basic OnBhc3N3b3Jk", + }, + { + description: "returns undefined when neither provided", + input: {}, + expected: undefined, + }, + { + description: "returns undefined when both are empty strings", + input: { username: "", password: "" }, + expected: undefined, + }, ]; toHeaderTests.forEach(({ description, input, expected }) => { diff --git a/tests/unit/fetcher/createRequestUrl.test.ts b/tests/unit/fetcher/createRequestUrl.test.ts index a92f1b5e..7787e553 100644 --- a/tests/unit/fetcher/createRequestUrl.test.ts +++ b/tests/unit/fetcher/createRequestUrl.test.ts @@ -77,7 +77,7 @@ describe("Test createRequestUrl", () => { undefinedValue: undefined, emptyString: "", }, - expected: "https://api.example.com?valid=value&nullValue=&emptyString=", + expected: "https://api.example.com?valid=value&emptyString=", }, { description: "should handle deeply nested objects", @@ -160,4 +160,8 @@ describe("Test createRequestUrl", () => { expect(createRequestUrl(baseUrl, queryParams)).toBe(expected); }); }); + + it("should default to repeat format for arrays", () => { + expect(createRequestUrl(BASE_URL, { items: ["a", "b"] })).toBe("https://api.example.com?items=a&items=b"); + }); }); diff --git a/tests/unit/fetcher/getFetchFn.test.ts b/tests/unit/fetcher/getFetchFn.test.ts new file mode 100644 index 00000000..ac05ab2f --- /dev/null +++ b/tests/unit/fetcher/getFetchFn.test.ts @@ -0,0 +1,22 @@ +import { getFetchFn } from "../../../src/core/fetcher/getFetchFn"; +import { RUNTIME } from "../../../src/core/runtime"; + +describe("Test for getFetchFn", () => { + it("should get node-fetch function", async () => { + if (RUNTIME.type === "node") { + if (RUNTIME.parsedVersion != null && RUNTIME.parsedVersion >= 18) { + expect(await getFetchFn()).toBe(fetch); + } else { + expect(await getFetchFn()).toEqual((await import("node-fetch")).default as any); + } + } + }); + + it("should get fetch function", async () => { + if (RUNTIME.type === "browser") { + const fetchFn = await getFetchFn(); + expect(typeof fetchFn).toBe("function"); + expect(fetchFn.name).toBe("fetch"); + } + }); +}); diff --git a/tests/unit/url/QueryStringBuilder.test.ts b/tests/unit/url/QueryStringBuilder.test.ts new file mode 100644 index 00000000..1afa2d22 --- /dev/null +++ b/tests/unit/url/QueryStringBuilder.test.ts @@ -0,0 +1,236 @@ +import { queryBuilder } from "../../../src/core/url/QueryStringBuilder"; + +describe("QueryStringBuilder", () => { + describe("add() — default repeat format", () => { + it("adds a scalar string value", () => { + const qs = queryBuilder().add("key", "value").build(); + expect(qs).toBe("key=value"); + }); + + it("adds a scalar number value", () => { + const qs = queryBuilder().add("limit", 10).build(); + expect(qs).toBe("limit=10"); + }); + + it("adds a boolean value", () => { + const qs = queryBuilder().add("active", true).build(); + expect(qs).toBe("active=true"); + }); + + it("skips undefined values", () => { + const qs = queryBuilder().add("key", undefined).build(); + expect(qs).toBe(""); + }); + + it("skips null values", () => { + const qs = queryBuilder().add("key", null).build(); + expect(qs).toBe(""); + }); + + it("repeats array elements as separate key=value pairs", () => { + const qs = queryBuilder().add("color", ["red", "blue", "green"]).build(); + expect(qs).toBe("color=red&color=blue&color=green"); + }); + + it("skips undefined items within arrays", () => { + const qs = queryBuilder().add("color", ["red", undefined, "blue"]).build(); + expect(qs).toBe("color=red&color=blue"); + }); + + it("returns empty string for empty array", () => { + const qs = queryBuilder().add("color", []).build(); + expect(qs).toBe(""); + }); + + it("encodes special characters in keys and values", () => { + const qs = queryBuilder().add("my key", "hello world").build(); + expect(qs).toBe("my%20key=hello%20world"); + }); + + it("handles nested objects", () => { + const qs = queryBuilder().add("filter", { status: "active" }).build(); + expect(qs).toBe("filter%5Bstatus%5D=active"); + }); + }); + + describe("add() — comma style", () => { + it("joins array values with literal commas", () => { + const qs = queryBuilder().add("tags", ["a", "b", "c"], { style: "comma" }).build(); + expect(qs).toBe("tags=a,b,c"); + }); + + it("handles single-element array", () => { + const qs = queryBuilder().add("tags", ["only"], { style: "comma" }).build(); + expect(qs).toBe("tags=only"); + }); + + it("returns empty string for empty array", () => { + const qs = queryBuilder().add("tags", [], { style: "comma" }).build(); + expect(qs).toBe(""); + }); + + it("skips undefined values", () => { + const qs = queryBuilder().add("tags", undefined, { style: "comma" }).build(); + expect(qs).toBe(""); + }); + + it("skips null values", () => { + const qs = queryBuilder().add("tags", null, { style: "comma" }).build(); + expect(qs).toBe(""); + }); + + it("treats scalar values same as default add()", () => { + const qs = queryBuilder().add("tag", "single", { style: "comma" }).build(); + expect(qs).toBe("tag=single"); + }); + + it("encodes commas within individual values as %2C", () => { + const qs = queryBuilder().add("items", ["a,b", "c"], { style: "comma" }).build(); + expect(qs).toBe("items=a%2Cb,c"); + }); + + it("encodes special characters in values", () => { + const qs = queryBuilder().add("tags", ["hello world", "foo&bar"], { style: "comma" }).build(); + expect(qs).toBe("tags=hello%20world,foo%26bar"); + }); + }); + + describe("chaining", () => { + it("chains multiple add() calls", () => { + const qs = queryBuilder().add("limit", 10).add("offset", 20).build(); + expect(qs).toBe("limit=10&offset=20"); + }); + + it("chains add() with default and comma styles", () => { + const qs = queryBuilder() + .add("limit", 10) + .add("tags", ["ACCESS_GRANTED", "COPY", "DELETE"], { style: "comma" }) + .add("active", true) + .build(); + expect(qs).toBe("limit=10&tags=ACCESS_GRANTED,COPY,DELETE&active=true"); + }); + + it("skips undefined/null params in chain without breaking", () => { + const qs = queryBuilder() + .add("a", "1") + .add("b", undefined) + .add("c", null, { style: "comma" }) + .add("d", "4") + .build(); + expect(qs).toBe("a=1&d=4"); + }); + }); + + describe("addMany()", () => { + it("adds all params from a record", () => { + const qs = queryBuilder().addMany({ limit: 10, offset: 20, name: "test" }).build(); + expect(qs).toBe("limit=10&offset=20&name=test"); + }); + + it("skips null and undefined values", () => { + const qs = queryBuilder().addMany({ a: "1", b: null, c: undefined, d: "4" }).build(); + expect(qs).toBe("a=1&d=4"); + }); + + it("handles empty record", () => { + const qs = queryBuilder().addMany({}).build(); + expect(qs).toBe(""); + }); + + it("works with comma-style override after addMany", () => { + const params = { limit: 10, tags: ["a", "b"], active: true }; + const qs = queryBuilder().addMany(params).add("tags", params.tags, { style: "comma" }).build(); + expect(qs).toBe("limit=10&tags=a,b&active=true"); + }); + + it("handles array values with default repeat format", () => { + const qs = queryBuilder() + .addMany({ ids: [1, 2, 3] }) + .build(); + expect(qs).toBe("ids=1&ids=2&ids=3"); + }); + }); + + describe("mergeAdditional()", () => { + it("appends additional params", () => { + const qs = queryBuilder().add("limit", 10).mergeAdditional({ extra: "value" }).build(); + expect(qs).toBe("limit=10&extra=value"); + }); + + it("overrides existing keys (last-write-wins)", () => { + const qs = queryBuilder().add("limit", 10).mergeAdditional({ limit: 20 }).build(); + expect(qs).toBe("limit=20"); + }); + + it("handles undefined additional params", () => { + const qs = queryBuilder().add("limit", 10).mergeAdditional(undefined).build(); + expect(qs).toBe("limit=10"); + }); + + it("skips undefined values in additional params", () => { + const qs = queryBuilder().add("limit", 10).mergeAdditional({ extra: undefined }).build(); + expect(qs).toBe("limit=10"); + }); + + it("skips null values in additional params", () => { + const qs = queryBuilder().add("limit", 10).mergeAdditional({ extra: null }).build(); + expect(qs).toBe("limit=10"); + }); + + it("handles array values in additional params using repeat format", () => { + const qs = queryBuilder() + .mergeAdditional({ ids: [1, 2, 3] }) + .build(); + expect(qs).toBe("ids=1&ids=2&ids=3"); + }); + + it("overrides a comma-style param with repeat format", () => { + const qs = queryBuilder() + .add("tags", ["a", "b"], { style: "comma" }) + .mergeAdditional({ tags: ["x", "y"] }) + .build(); + expect(qs).toBe("tags=x&tags=y"); + }); + }); + + describe("build()", () => { + it("returns empty string when no params added", () => { + const qs = queryBuilder().build(); + expect(qs).toBe(""); + }); + + it("does not include leading ?", () => { + const qs = queryBuilder().add("key", "value").build(); + expect(qs).not.toContain("?"); + }); + }); + + describe("end-to-end scenarios", () => { + it("matches expected query-parameters-openapi output pattern", () => { + const params: Record = { + limit: 1, + id: "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32", + date: "2023-01-15", + deadline: "2024-01-15T09:30:00.000Z", + bytes: "SGVsbG8gd29ybGQh", + user: "user", + userList: ["user"], + optionalString: "optionalString", + nestedUser: "nestedUser", + excludeUser: "excludeUser", + filter: "filter", + tags: ["tags"], + optionalTags: undefined, + }; + const qs = queryBuilder() + .addMany(params) + .add("tags", params.tags, { style: "comma" }) + .add("optionalTags", params.optionalTags, { style: "comma" }) + .mergeAdditional(undefined) + .build(); + expect(qs).toContain("limit=1"); + expect(qs).toContain("tags=tags"); + expect(qs).not.toContain("optionalTags"); + }); + }); +}); diff --git a/tests/unit/url/encodePathParam.test.ts b/tests/unit/url/encodePathParam.test.ts new file mode 100644 index 00000000..4267475f --- /dev/null +++ b/tests/unit/url/encodePathParam.test.ts @@ -0,0 +1,46 @@ +import { encodePathParam, join } from "../../../src/core/url/index"; + +class InvalidPathParameterError extends Error { + constructor({ message }: { message: string }) { + super(message); + this.name = "InvalidPathParameterError"; + } +} + +describe("encodePathParam", () => { + it.each([ + ["usr_123", "usr_123"], + ["a/b", "a%2Fb"], + ["a b", "a%20b"], + ["a?b#c", "a%3Fb%23c"], + ["...", "..."], + [".a", ".a"], + ["a..b", "a..b"], + ["%2E%2E", "%252E%252E"], + ["", ""], + [42, "42"], + [true, "true"], + [null, "null"], + [undefined, "undefined"], + ])("encodes %j as %j", (input, expected) => { + expect(encodePathParam(input)).toBe(expected); + }); + + it.each([".", ".."])("rejects the dot segment %j", (input) => { + expect(() => encodePathParam(input)).toThrow(`Invalid path parameter "${input}"`); + }); + + it("throws the provided error class", () => { + expect(() => encodePathParam("..", InvalidPathParameterError)).toThrow(InvalidPathParameterError); + }); + + it("does not throw the provided error class for valid values", () => { + expect(encodePathParam("usr_123", InvalidPathParameterError)).toBe("usr_123"); + }); + + it("keeps encoded values in the path when joined with a base URL", () => { + expect(join("https://api.example.com/api/v2", `/users/${encodePathParam("...")}/roles`)).toBe( + "https://api.example.com/api/v2/users/.../roles", + ); + }); +}); diff --git a/tests/unit/url/qs.test.ts b/tests/unit/url/qs.test.ts index 42cdffb9..54d2d9ce 100644 --- a/tests/unit/url/qs.test.ts +++ b/tests/unit/url/qs.test.ts @@ -34,7 +34,7 @@ describe("Test qs toQueryString", () => { interface ArrayTestCase { description: string; input: any; - options?: { arrayFormat?: "repeat" | "indices" }; + options?: { arrayFormat?: "repeat" | "indices" | "comma" }; expected: string; } @@ -150,7 +150,7 @@ describe("Test qs toQueryString", () => { interface MixedTestCase { description: string; input: any; - options?: { arrayFormat?: "repeat" | "indices" }; + options?: { arrayFormat?: "repeat" | "indices" | "comma" }; expected: string; } @@ -189,12 +189,12 @@ describe("Test qs toQueryString", () => { { description: "should handle arrays with null/undefined values", input: { items: ["a", null, "c", undefined, "e"] }, - expected: "items%5B0%5D=a&items%5B1%5D=&items%5B2%5D=c&items%5B4%5D=e", + expected: "items%5B0%5D=a&items%5B2%5D=c&items%5B4%5D=e", }, { description: "should handle objects with null/undefined values", input: { name: "John", age: null, email: undefined, active: true }, - expected: "name=John&age=&active=true", + expected: "name=John&active=true", }, ]; @@ -241,11 +241,107 @@ describe("Test qs toQueryString", () => { }); }); + describe("Comma array format", () => { + interface CommaTestCase { + description: string; + input: any; + options?: { arrayFormat?: "comma"; encode?: boolean }; + expected: string; + } + + const commaTests: CommaTestCase[] = [ + { + description: "should join array values with commas", + input: { event_type: ["ACCESS_GRANTED", "COPY", "DELETE"] }, + options: { arrayFormat: "comma" }, + expected: "event_type=ACCESS_GRANTED,COPY,DELETE", + }, + { + description: "should handle single-element array", + input: { event_type: ["ACCESS_GRANTED"] }, + options: { arrayFormat: "comma" }, + expected: "event_type=ACCESS_GRANTED", + }, + { + description: "should handle empty array", + input: { event_type: [] }, + options: { arrayFormat: "comma" }, + expected: "", + }, + { + description: "should not percent-encode commas", + input: { items: ["a", "b", "c"] }, + options: { arrayFormat: "comma" }, + expected: "items=a,b,c", + }, + { + description: "should encode values but not commas", + input: { items: ["a b", "c d"] }, + options: { arrayFormat: "comma" }, + expected: "items=a%20b,c%20d", + }, + { + description: "should not encode when encode is false", + input: { items: ["a b", "c d"] }, + options: { arrayFormat: "comma", encode: false }, + expected: "items=a b,c d", + }, + { + description: "should handle mixed parameters with comma and non-array values", + input: { event_type: ["ACCESS_GRANTED", "COPY", "DELETE"], limit: 10, offset: 0 }, + options: { arrayFormat: "comma" }, + expected: "event_type=ACCESS_GRANTED,COPY,DELETE&limit=10&offset=0", + }, + { + description: "should handle numeric array values", + input: { ids: [1, 2, 3] }, + options: { arrayFormat: "comma" }, + expected: "ids=1,2,3", + }, + { + description: "should handle boolean array values", + input: { flags: [true, false, true] }, + options: { arrayFormat: "comma" }, + expected: "flags=true,false,true", + }, + { + description: "should skip null values in comma format", + input: { items: ["a", null, "c"] }, + options: { arrayFormat: "comma" }, + expected: "items=a,c", + }, + { + description: "should skip undefined values in comma format", + input: { items: ["a", undefined, "c"] }, + options: { arrayFormat: "comma" }, + expected: "items=a,c", + }, + { + description: "should produce empty string for all-null array in comma format", + input: { items: [null, undefined] }, + options: { arrayFormat: "comma" }, + expected: "", + }, + { + description: "should encode commas within values while keeping separator commas literal", + input: { items: ["a,b", "c"] }, + options: { arrayFormat: "comma" }, + expected: "items=a%2Cb,c", + }, + ]; + + commaTests.forEach(({ description, input, options, expected }) => { + it(description, () => { + expect(toQueryString(input, options)).toBe(expected); + }); + }); + }); + describe("Options combinations", () => { interface OptionsTestCase { description: string; input: any; - options?: { arrayFormat?: "repeat" | "indices"; encode?: boolean }; + options?: { arrayFormat?: "repeat" | "indices" | "comma"; encode?: boolean }; expected: string; } diff --git a/tests/unit/utils/setObjectProperty.test.ts b/tests/unit/utils/setObjectProperty.test.ts index 29f8e638..36bf33d6 100644 --- a/tests/unit/utils/setObjectProperty.test.ts +++ b/tests/unit/utils/setObjectProperty.test.ts @@ -74,3 +74,39 @@ describe("Test setObjectProperty", () => { expect(result).toEqual(wantObject); }); }); + +describe("setObjectProperty does not modify its input", () => { + test("top-level property", () => { + const original = { cursor: "a", limit: 10 }; + const result = setObjectProperty(original, "cursor", "b"); + expect(result).toEqual({ cursor: "b", limit: 10 }); + expect(original).toEqual({ cursor: "a", limit: 10 }); + }); + + test("nested property", () => { + const options = { offset: 0, count: 2 }; + const original = { id: "x", options }; + const result = setObjectProperty(original, "options.offset", 2); + expect(result).toEqual({ id: "x", options: { offset: 2, count: 2 } }); + expect(original).toEqual({ id: "x", options: { offset: 0, count: 2 } }); + expect(original.options).toBe(options); + expect(result.options).not.toBe(options); + }); + + test("missing nested object", () => { + const original: { id: string; options?: { offset?: number } } = { id: "x" }; + const result = setObjectProperty(original, "options.offset", 2); + expect(result).toEqual({ id: "x", options: { offset: 2 } }); + expect(original).toEqual({ id: "x" }); + }); + + test("array along the path stays an array", () => { + const items = [{ name: "a" }]; + const original = { items }; + const result = setObjectProperty(original, "items.0", { name: "b" }); + expect(Array.isArray(result.items)).toBe(true); + expect(result.items).toEqual([{ name: "b" }]); + expect(original.items).toBe(items); + expect(items).toEqual([{ name: "a" }]); + }); +});