// 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 { buildHeaders } from '../../internal/headers'; import { RequestOptions } from '../../internal/request-options'; import { path } from '../../internal/utils/path'; export class Aip extends APIResource { /** * Get media file by knowledge base ID, file ID, and media ID. */ retrieve(mediaID: string, params: AipRetrieveParams, options?: RequestOptions): APIPromise { const { kb_id, file_id, 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat } = params; return this._client.get(path`/media/${kb_id}/${file_id}/${mediaID}`, { ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } /** * Get AIP media file via proxy with presigned URL regeneration. */ list(params: AipListParams, options?: RequestOptions): APIPromise { const { 'Accept-Language': acceptLanguage, 'X-Error-Format': xErrorFormat, ...query } = params; return this._client.get('/media/aip', { query, ...options, headers: buildHeaders([ { ...(acceptLanguage != null ? { 'Accept-Language': acceptLanguage } : undefined), ...(xErrorFormat != null ? { 'X-Error-Format': xErrorFormat } : undefined), }, options?.headers, ]), }); } } export type AipRetrieveResponse = unknown; export type AipListResponse = unknown; export interface AipRetrieveParams { /** * Path param */ kb_id: string; /** * Path param */ file_id: string; /** * 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; } export interface AipListParams { /** * Query param: The object path in AIP storage (URL encoded) */ object_path: string; /** * Query param: Signed, URL-safe fallback token for the original presigned URL. * Generated by the backend and used only when AIP is unavailable. */ fallback?: string | null; /** * Query param: Hourly cache-busting parameter (YYYYMMDDHH format) */ t?: 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; } export declare namespace Aip { export { type AipRetrieveResponse as AipRetrieveResponse, type AipListResponse as AipListResponse, type AipRetrieveParams as AipRetrieveParams, type AipListParams as AipListParams, }; }