import type { components } from '../generated/openapi.js'; import type { RequestOptions } from '../types.js'; import { BaseResource } from './base.js'; export type Attachment = components['schemas']['Attachment']; export type CreateAttachmentBody = components['schemas']['CreateAttachment']; export type CreateAttachmentResponse = components['schemas']['CreateAttachmentResponse']; export type UploadInput = Blob | ArrayBuffer | Uint8Array; export interface UploadMetadata { filename: string; contentType: string; } export interface UploadOptions extends RequestOptions { /** Override the polling interval in ms while waiting for `status: ready`. Default 500. */ pollIntervalMs?: number; /** Override the maximum number of polls before giving up. Default 60 (≈30s at 500ms). */ maxPolls?: number; } export declare class AttachmentsResource extends BaseResource { /** * `POST /v1/attachments` — register an attachment and receive a * presigned R2 upload URL. Step 1 of the 3-step upload flow; prefer the * high-level `upload()` unless you need control over each step. * * Note: the contract has no DELETE /v1/attachments/{id} endpoint — rows * auto-expire after 72h via the retention worker. Don't add a delete * method here unless the backend ships one. */ create(body: CreateAttachmentBody, opts?: RequestOptions): Promise; /** `GET /v1/attachments/{id}` — fetch an attachment's status and download URL. */ get(id: string, opts?: RequestOptions): Promise; /** * Transparent 3-step attachment upload: * 1. `POST /v1/attachments` to register the file and get a presigned R2 URL * 2. `PUT` the body directly to R2 with the required headers * 3. Poll `GET /v1/attachments/{id}` every `pollIntervalMs` until `status === 'ready'` * * Throws: * - `BadRequestError` if `size_bytes` exceeds the 5 GB cap * - `APIError` (`upload_failed`) if the R2 PUT returns non-2xx * - `APIError` (`upload_failed`) if the server transitions to `status: failed` * - `APIError` (`upload_timeout`) if `status` is still `uploading` after `maxPolls × pollIntervalMs` */ upload(file: UploadInput, metadata: UploadMetadata, opts?: UploadOptions): Promise; } //# sourceMappingURL=attachments.d.ts.map