// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../../core/resource'; import * as V1API from './v1/v1'; import { V1 } from './v1/v1'; import { APIPromise } from '../../core/api-promise'; import { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; export class API extends APIResource { v1: V1API.V1 = new V1API.V1(this._client); /** * Create a one-time URL for rendering HTML from a message on the preview domain. */ previewToken(params: APIPreviewTokenParams, options?: RequestOptions): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...body } = params; return this._client.post('/api/preview-token', { body, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } /** * Response containing a preview-service URL. */ export interface APIPreviewTokenResponse { url: string; } export interface APIPreviewTokenParams { /** * Body param */ message_id: string; /** * Body param */ shared_conversation_id?: string | null; /** * Header param */ 'Accept-Language'?: string; /** * Header param: Set to `structured` to receive errors in the structured envelope. * Omit it to keep the legacy error body. */ 'X-Error-Format'?: string; } API.V1 = V1; export declare namespace API { export { type APIPreviewTokenResponse as APIPreviewTokenResponse, type APIPreviewTokenParams as APIPreviewTokenParams, }; export { V1 as V1 }; }