intercom-client
Version:
Official Node bindings to the Intercom API
156 lines (155 loc) • 6.61 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 Articles {
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 Articles
*/
export declare class Articles {
protected readonly _options: Articles.Options;
constructor(_options?: Articles.Options);
/**
* You can fetch a list of all articles by making a GET request to `https://api.intercom.io/articles`.
*
* > 📘 How are the articles sorted and ordered?
* >
* > Articles will be returned in descending order on the `updated_at` attribute. This means if you need to iterate through results then we'll show the most recently updated articles first.
*
* @param {Intercom.ListArticlesRequest} request
* @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.UnauthorizedError}
*
* @example
* await client.articles.list()
*/
list(request?: Intercom.ListArticlesRequest, requestOptions?: Articles.RequestOptions): Promise<core.Page<Intercom.ArticleListItem>>;
/**
* You can create a new article by making a POST request to `https://api.intercom.io/articles`.
*
* @param {Intercom.CreateArticleRequest} request
* @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.BadRequestError}
* @throws {@link Intercom.UnauthorizedError}
*
* @example
* await client.articles.create({
* title: "Thanks for everything",
* description: "Description of the Article",
* body: "Body of the Article",
* author_id: 991267407,
* state: "published",
* parent_id: 145,
* parent_type: "collection",
* translated_content: {
* fr: {
* type: "article_content",
* title: "Merci pour tout",
* description: "Description de l'article",
* body: "Corps de l'article",
* author_id: 991267407,
* state: "published"
* }
* }
* })
*
* @example
* await client.articles.create({
* title: "Thanks for everything",
* description: "Description of the Article",
* body: "Body of the Article",
* author_id: 1295,
* state: "published"
* })
*/
create(request: Intercom.CreateArticleRequest, requestOptions?: Articles.RequestOptions): Promise<Intercom.Article>;
/**
* You can fetch the details of a single article by making a GET request to `https://api.intercom.io/articles/<id>`.
*
* @param {Intercom.FindArticleRequest} request
* @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.UnauthorizedError}
* @throws {@link Intercom.NotFoundError}
*
* @example
* await client.articles.find({
* article_id: "123"
* })
*/
find(request: Intercom.FindArticleRequest, requestOptions?: Articles.RequestOptions): Promise<Intercom.Article>;
/**
* You can update the details of a single article by making a PUT request to `https://api.intercom.io/articles/<id>`.
*
* @param {Intercom.UpdateArticleRequest} request
* @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.UnauthorizedError}
* @throws {@link Intercom.NotFoundError}
*
* @example
* await client.articles.update({
* article_id: "123",
* title: "Christmas is here!",
* body: "<p>New gifts in store for the jolly season</p>"
* })
*/
update(request: Intercom.UpdateArticleRequest, requestOptions?: Articles.RequestOptions): Promise<Intercom.Article>;
/**
* You can delete a single article by making a DELETE request to `https://api.intercom.io/articles/<id>`.
*
* @param {Intercom.DeleteArticleRequest} request
* @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.UnauthorizedError}
* @throws {@link Intercom.NotFoundError}
*
* @example
* await client.articles.delete({
* article_id: "123"
* })
*/
delete(request: Intercom.DeleteArticleRequest, requestOptions?: Articles.RequestOptions): Promise<Intercom.DeletedArticleObject>;
/**
* You can search for articles by making a GET request to `https://api.intercom.io/articles/search`.
*
* @param {Intercom.SearchArticlesRequest} request
* @param {Articles.RequestOptions} requestOptions - Request-specific configuration.
*
* @throws {@link Intercom.UnauthorizedError}
*
* @example
* await client.articles.search({
* phrase: "Getting started",
* state: "published"
* })
*/
search(request?: Intercom.SearchArticlesRequest, requestOptions?: Articles.RequestOptions): Promise<Intercom.SearchArticlesResponse>;
protected _getAuthorizationHeader(): Promise<string>;
}