intercom-client
Version:
Official Node bindings to the Intercom API
155 lines (154 loc) • 5.81 kB
TypeScript
/**
* 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 DataAttributes {
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 Data Attributes
*/
export declare class DataAttributes {
protected readonly _options: DataAttributes.Options;
constructor(_options?: DataAttributes.Options);
/**
* You can fetch a list of all data attributes belonging to a workspace for contacts, companies or conversations.
*
* @param {Intercom.ListDataAttributesRequest} request
* @param {DataAttributes.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.UnauthorizedError}
*
* @example
* await client.dataAttributes.list()
*/
list(request?: Intercom.ListDataAttributesRequest, requestOptions?: DataAttributes.RequestOptions): core.HttpResponsePromise<Intercom.DataAttributeList>;
private __list;
/**
* You can create a data attributes for a `contact` or a `company`.
*
* @param {Intercom.CreateDataAttributeRequest} request
* @param {DataAttributes.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.BadRequestError}
* @throws {@link Intercom.UnauthorizedError}
*
* @example
* await client.dataAttributes.create({
* name: "Mithril Shirt",
* model: "company",
* data_type: "string"
* })
*
* @example
* await client.dataAttributes.create({
* name: "The One Ring",
* model: "contact",
* data_type: "integer"
* })
*
* @example
* await client.dataAttributes.create({
* name: "!nv@l!d n@me",
* model: "company",
* data_type: "string"
* })
*
* @example
* await client.dataAttributes.create({
* name: "The One Ring",
* model: "company",
* data_type: "string"
* })
*
* @example
* await client.dataAttributes.create({
* name: "The Second Ring",
* model: "company",
* data_type: "string"
* })
*
* @example
* await client.dataAttributes.create({
* name: "My Data Attribute",
* model: "contact",
* data_type: "string",
* description: "Just a plain old ring",
* options: ["options"]
* })
*/
create(request: Intercom.CreateDataAttributeRequest, requestOptions?: DataAttributes.RequestOptions): core.HttpResponsePromise<Intercom.DataAttribute>;
private __create;
/**
*
* You can update a data attribute.
*
* > 🚧 Updating the data type is not possible
* >
* > 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.UpdateDataAttributeRequest} request
* @param {DataAttributes.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.BadRequestError}
* @throws {@link Intercom.UnauthorizedError}
* @throws {@link Intercom.NotFoundError}
* @throws {@link Intercom.UnprocessableEntityError}
*
* @example
* await client.dataAttributes.update({
* data_attribute_id: "1",
* archived: false,
* description: "Just a plain old ring",
* options: [{
* value: "1-10"
* }, {
* value: "11-20"
* }]
* })
*
* @example
* await client.dataAttributes.update({
* data_attribute_id: "1",
* archived: false,
* description: "Too few options",
* options: [{
* value: "value"
* }, {
* value: "value"
* }]
* })
*
* @example
* await client.dataAttributes.update({
* data_attribute_id: "1",
* archived: true,
* description: "Trying to archieve"
* })
*/
update(request: Intercom.UpdateDataAttributeRequest, requestOptions?: DataAttributes.RequestOptions): core.HttpResponsePromise<Intercom.DataAttribute>;
private __update;
protected _getAuthorizationHeader(): Promise<string>;
}