import type { APIPromise } from "../core/api-promise.mjs"; import type { RequestOptions } from "../internal/request-options.mjs"; import { Assets, type AssetRetrieveParams, type AssetRetrieveResponse, type AssetUpdateParams, type AssetUpdateResponse } from "../resources/assets/assets.mjs"; /** Asset methods added on top of the original asset fields. */ export declare class AssetMethods { /** * Fetch the asset's content as bytes, using the signed `url` field on the * asset. Works in Node ≥18 and in browsers with no extra setup. * * This is a thin wrapper around `fetch(asset.url)` — use `asset.url` * directly if you need streaming or a Response object. * * @example * ```ts * const res = await client.assets.retrieve(assetId); * const bytes = await res.asset.download(); * await fs.writeFile('out.png', bytes); * ``` */ download(this: Asset): Promise; /** @internal Create an Asset from raw asset data. */ static from(data: AssetRetrieveResponse['asset']): Asset; } /** An asset with all original fields plus `.download()`. */ export type Asset = AssetRetrieveResponse.Asset & AssetMethods; export declare const Asset: typeof AssetMethods; /** * @internal Helper type: adds `.download()` to the `asset` field of a response. * Uses intersection so the original response type is preserved — a `WithAsset` is still assignable to `T`. */ export type WithAsset = T & { asset: AssetMethods; }; /** * @internal Wrap `_thenUnwrap` to replace `response.asset` with an enhanced Asset. */ export declare function enhanceAsset(promise: APIPromise): APIPromise>; /** * Enhanced Assets resource. * All original methods (and subresources like `download`, `public`) are * inherited. `retrieve` and `update` responses' `asset` field gains a * `.download()` helper for fetching the asset's bytes. */ export declare class EnhancedAssets extends Assets { retrieve(assetID: string, query?: AssetRetrieveParams | null | undefined, options?: RequestOptions): APIPromise>; update(assetID: string, params: AssetUpdateParams, options?: RequestOptions): APIPromise>; } //# sourceMappingURL=asset.d.mts.map