UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

37 lines • 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ToMarkdown = exports.BaseToMarkdown = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../core/resource.js"); const pagination_1 = require("../../core/pagination.js"); const uploads_1 = require("../../internal/uploads.js"); const path_1 = require("../../internal/utils/path.js"); var BaseToMarkdown = /* @__PURE__ */ (() => { class BaseToMarkdown extends resource_1.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((0, path_1.path) `/accounts/${account_id}/ai/tomarkdown/supported`, (pagination_1.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((0, path_1.path) `/accounts/${account_id}/ai/tomarkdown`, (pagination_1.SinglePage), (0, uploads_1.multipartFormRequestOptions)({ body: file, method: 'post', ...options }, this._client)); } } BaseToMarkdown._key = Object.freeze(['ai', 'toMarkdown']); return BaseToMarkdown; })(); exports.BaseToMarkdown = BaseToMarkdown; class ToMarkdown extends BaseToMarkdown { } exports.ToMarkdown = ToMarkdown; //# sourceMappingURL=to-markdown.js.map