// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import { APIPromise } from '../../core/api-promise'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class Articles extends APIResource { /** * Create a new article */ create(id: string, body: ArticleCreateParams, options?: RequestOptions): APIPromise
{ return this._client.post(path`/knowledge-bases/${id}/articles`, { body, ...options }); } /** * Update an article */ update(articleID: string, params: ArticleUpdateParams, options?: RequestOptions): APIPromise
{ const { id, ...body } = params; return this._client.patch(path`/knowledge-bases/${id}/articles/${articleID}`, { body, ...options }); } } export interface Article { data?: Article.Data; request_id?: string; } export namespace Article { export interface Data { id?: string; current_published_content_html?: string; identifier?: string; is_published?: boolean; last_published_at?: string; slug?: string; title?: string; } } export interface ArticleCreateParams { /** * The HTML body of the article */ body_html: string; /** * The title of the article */ title: string; /** * The ID of the user attributed as the author */ author_user_id?: string; /** * The ID of the collection to add the article to */ collection_id?: string; /** * Whether the article should be published */ is_published?: boolean; /** * Whether the article can only be accessible via direct link */ is_unlisted?: boolean; /** * The slug of the article */ slug?: string; translations?: Array; visibility_config?: ArticleCreateParams.VisibilityConfig; } export namespace ArticleCreateParams { export interface Translation { body_html?: string; language?: string; title?: string; } export interface VisibilityConfig { visibility?: string; } } export interface ArticleUpdateParams { /** * Path param: The KnowledgeBaseID of the article to update */ id: string; /** * Body param: The HTML body of the article */ body_html?: string; /** * Body param: Whether the changes should be published */ publish_updated_body_html?: boolean; /** * Body param: The title of the article */ title?: string; } export declare namespace Articles { export { type Article as Article, type ArticleCreateParams as ArticleCreateParams, type ArticleUpdateParams as ArticleUpdateParams, }; }