UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

32 lines • 1.59 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../core/resource.mjs"; import { SinglePage } from "../../core/pagination.mjs"; import { multipartFormRequestOptions } from "../../internal/uploads.mjs"; import { path } from "../../internal/utils/path.mjs"; export var BaseToMarkdown = /* @__PURE__ */ (() => { class BaseToMarkdown extends APIResource { /** * Lists the file extensions and MIME types accepted by Workers AI's Markdown * conversion endpoint. Use this list to check whether a file can be converted * before uploading it. */ supported(params, options) { const { account_id } = params; return this._client.getAPIList(path `/accounts/${account_id}/ai/tomarkdown/supported`, (SinglePage), options); } /** * Converts files uploaded as multipart form data into Markdown using Workers AI. * Returns a conversion result for each file. Use the supported-formats endpoint to * check accepted file types. */ transform(params, options) { const { account_id, file } = params; return this._client.getAPIList(path `/accounts/${account_id}/ai/tomarkdown`, (SinglePage), multipartFormRequestOptions({ body: file, method: 'post', ...options }, this._client)); } } BaseToMarkdown._key = Object.freeze(['ai', 'toMarkdown']); return BaseToMarkdown; })(); export class ToMarkdown extends BaseToMarkdown { } //# sourceMappingURL=to-markdown.mjs.map