UNPKG

intercom-client

Version:

Official Node bindings to the Intercom API

87 lines (86 loc) 3.54 kB
import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js"; import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js"; import * as core from "../../../../core/index.js"; import * as Intercom from "../../../index.js"; export declare namespace VisitorsClient { interface Options extends BaseClientOptions { } interface RequestOptions extends BaseRequestOptions { } } /** * Everything about your Visitors */ export declare class VisitorsClient { protected readonly _options: NormalizedClientOptionsWithAuth<VisitorsClient.Options>; constructor(options?: VisitorsClient.Options); /** * You can fetch the details of a single visitor. * * @param {Intercom.FindVisitorRequest} request * @param {VisitorsClient.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?: VisitorsClient.RequestOptions): core.HttpResponsePromise<Intercom.Visitor | undefined>; 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 {VisitorsClient.RequestOptions} requestOptions - Request-specific configuration. * * @throws {@link Intercom.UnauthorizedError} * @throws {@link Intercom.NotFoundError} * * @example * await client.visitors.update({ * id: "6762f30c1bb69f9f2193bc5e", * name: "Gareth Bale" * }) * * @example * await client.visitors.update({ * user_id: "fail", * name: "Christian Fail" * }) */ update(request: Intercom.UpdateVisitorRequest, requestOptions?: VisitorsClient.RequestOptions): core.HttpResponsePromise<Intercom.Visitor | undefined>; 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 {VisitorsClient.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?: VisitorsClient.RequestOptions): core.HttpResponsePromise<Intercom.Contact>; private __mergeToContact; }