UNPKG

intercom-client

Version:

Official Node bindings to the Intercom API

107 lines (106 loc) 4.49 kB
/** * This file was auto-generated by Fern from our API Definition. */ import * as environments from "../../../../environments"; import * as core from "../../../../core"; import * as Intercom from "../../../index"; export declare namespace Visitors { interface Options { environment?: core.Supplier<environments.IntercomEnvironment | string>; /** Specify a custom URL to connect the client to. */ baseUrl?: core.Supplier<string>; token?: core.Supplier<core.BearerToken | undefined>; /** Override the Intercom-Version header */ version?: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "2.0" | "2.1" | "2.2" | "2.3" | "2.4" | "2.5" | "2.6" | "2.7" | "2.8" | "2.9" | "2.10" | "2.11" | "Unstable"; fetcher?: core.FetchFunction; } interface RequestOptions { /** The maximum time to wait for a response in seconds. */ timeoutInSeconds?: number; /** The number of times to retry the request. Defaults to 2. */ maxRetries?: number; /** A hook to abort the request. */ abortSignal?: AbortSignal; /** Additional headers to include in the request. */ headers?: Record<string, string>; /** Override the Intercom-Version header */ version?: "1.0" | "1.1" | "1.2" | "1.3" | "1.4" | "2.0" | "2.1" | "2.2" | "2.3" | "2.4" | "2.5" | "2.6" | "2.7" | "2.8" | "2.9" | "2.10" | "2.11" | "Unstable"; } } /** * Everything about your Visitors */ export declare class Visitors { protected readonly _options: Visitors.Options; constructor(_options?: Visitors.Options); /** * You can fetch the details of a single visitor. * * @param {Intercom.FindVisitorRequest} request * @param {Visitors.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * * @example * await client.visitors.find({ * user_id: "user_id" * }) */ find(request: Intercom.FindVisitorRequest, requestOptions?: Visitors.RequestOptions): core.HttpResponsePromise<Intercom.Visitor>; private __find; /** * Sending a PUT request to `/visitors` will result in an update of an existing Visitor. * * **Option 1.** You can update a visitor by passing in the `user_id` of the visitor in the Request body. * * **Option 2.** You can update a visitor by passing in the `id` of the visitor in the Request body. * * @param {Intercom.UpdateVisitorRequest} request * @param {Visitors.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * * @example * await client.visitors.update({ * id: "667d61cc8a68186f43bafe95", * name: "Gareth Bale" * }) * * @example * await client.visitors.update({ * user_id: "fail", * name: "Christian Fail" * }) */ update(request: Intercom.UpdateVisitorRequest, requestOptions?: Visitors.RequestOptions): core.HttpResponsePromise<Intercom.Visitor>; private __update; /** * You can merge a Visitor to a Contact of role type `lead` or `user`. * * > 📘 What happens upon a visitor being converted? * > * > If the User exists, then the Visitor will be merged into it, the Visitor deleted and the User returned. If the User does not exist, the Visitor will be converted to a User, with the User identifiers replacing it's Visitor identifiers. * * @param {Intercom.MergeVisitorToContactRequest} request * @param {Visitors.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} * * @example * await client.visitors.mergeToContact({ * type: "user", * user: { * id: "8a88a590-e1c3-41e2-a502-e0649dbf721c", * email: "foo@bar.com" * }, * visitor: { * user_id: "3ecf64d0-9ed1-4e9f-88e1-da7d6e6782f3" * } * }) */ mergeToContact(request: Intercom.MergeVisitorToContactRequest, requestOptions?: Visitors.RequestOptions): core.HttpResponsePromise<Intercom.Contact>; private __mergeToContact; protected _getAuthorizationHeader(): Promise<string>; }