intercom-client
Version:
Official Node bindings to the Intercom API
115 lines (114 loc) • 5.8 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 DataExport {
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 Exports
*/
export declare class DataExport {
protected readonly _options: DataExport.Options;
constructor(_options?: DataExport.Options);
/**
* To create your export job, you need to send a `POST` request to the export endpoint `https://api.intercom.io/export/content/data`.
*
* The only parameters you need to provide are the range of dates that you want exported.
*
* >🚧 Limit of one active job
* >
* > You can only have one active job per workspace. You will receive a HTTP status code of 429 with the message Exceeded rate limit of 1 pending message data export jobs if you attempt to create a second concurrent job.
*
* >❗️ Updated_at not included
* >
* > It should be noted that the timeframe only includes messages sent during the time period and not messages that were only updated during this period. For example, if a message was updated yesterday but sent two days ago, you would need to set the created_at_after date before the message was sent to include that in your retrieval job.
*
* >📘 Date ranges are inclusive
* >
* > Requesting data for 2018-06-01 until 2018-06-30 will get all data for those days including those specified - e.g. 2018-06-01 00:00:00 until 2018-06-30 23:59:99.
*
* @param {Intercom.CreateDataExportRequest} request
* @param {DataExport.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.dataExport.create({
* created_at_after: 1719474967,
* created_at_before: 1719492967
* })
*/
create(request: Intercom.CreateDataExportRequest, requestOptions?: DataExport.RequestOptions): core.HttpResponsePromise<Intercom.DataExport>;
private __create;
/**
* You can view the status of your job by sending a `GET` request to the URL
* `https://api.intercom.io/export/content/data/{job_identifier}` - the `{job_identifier}` is the value returned in the response when you first created the export job. More on it can be seen in the Export Job Model.
*
* > 🚧 Jobs expire after two days
* > All jobs that have completed processing (and are thus available to download from the provided URL) will have an expiry limit of two days from when the export ob completed. After this, the data will no longer be available.
*
* @param {Intercom.FindDataExportRequest} request
* @param {DataExport.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.dataExport.find({
* job_identifier: "job_identifier"
* })
*/
find(request: Intercom.FindDataExportRequest, requestOptions?: DataExport.RequestOptions): core.HttpResponsePromise<Intercom.DataExport>;
private __find;
/**
* You can cancel your job
*
* @param {Intercom.CancelDataExportRequest} request
* @param {DataExport.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.dataExport.cancel({
* job_identifier: "job_identifier"
* })
*/
cancel(request: Intercom.CancelDataExportRequest, requestOptions?: DataExport.RequestOptions): core.HttpResponsePromise<Intercom.DataExport>;
private __cancel;
/**
* When a job has a status of complete, and thus a filled download_url, you can download your data by hitting that provided URL, formatted like so: https://api.intercom.io/download/content/data/xyz1234.
*
* Your exported message data will be streamed continuously back down to you in a gzipped CSV format.
*
* > 📘 Octet header required
* >
* > You will have to specify the header Accept: `application/octet-stream` when hitting this endpoint.
*
* @param {Intercom.DownloadDataExportRequest} request
* @param {DataExport.RequestOptions} requestOptions - Request-specific configuration.
*
* @example
* await client.dataExport.download({
* job_identifier: "job_identifier"
* })
*/
download(request: Intercom.DownloadDataExportRequest, requestOptions?: DataExport.RequestOptions): core.HttpResponsePromise<void>;
private __download;
protected _getAuthorizationHeader(): Promise<string>;
}