UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

149 lines • 6.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Instances = exports.BaseInstances = void 0; const tslib_1 = require("../../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const JobsAPI = tslib_1.__importStar(require("./jobs.js")); const jobs_1 = require("./jobs.js"); const pagination_1 = require("../../../core/pagination.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseInstances = /* @__PURE__ */ (() => { class BaseInstances extends resource_1.APIResource { /** * Create a new AI Search instance with the given configuration. If type is omitted * or null, a non-blank HTTP(S) source infers web-crawler and an existing R2 bucket * source infers r2. A missing or blank source without a type creates a managed * upload-only instance. Search for Agents instances require the default namespace. * * Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances * (and descendant paths) instead. * * @deprecated */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/ai-search/instances`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Update an AI Search instance. Submitting Search for Agents metadata requires the * default namespace; omitting or removing it is allowed elsewhere. Submit Search * for Agents metadata and restrictive or unknown public endpoint changes or custom * domains in separate PUT requests, even when resubmitting unchanged metadata. * * Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances * (and descendant paths) instead. * * @deprecated */ update(id, params, options) { const { account_id, ...body } = params; return this._client.put((0, path_1.path) `/accounts/${account_id}/ai-search/instances/${id}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List all AI Search instances in the account. * * Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances * (and descendant paths) instead. * * @deprecated */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/ai-search/instances`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * Permanently delete an AI Search instance and all its indexed data. * * Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances * (and descendant paths) instead. * * @deprecated */ delete(id, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/ai-search/instances/${id}`, options)._thenUnwrap((obj) => obj.result); } /** * Performs a chat completion request against an AI Search instance, using indexed * content as context for generating responses. * * Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances * (and descendant paths) instead. * * @deprecated */ chatCompletions(id, params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/ai-search/instances/${id}/chat/completions`, { body, ...options, }); } /** * Retrieve the configuration and status of an AI Search instance. * * Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances * (and descendant paths) instead. * * @deprecated */ read(id, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/ai-search/instances/${id}`, options)._thenUnwrap((obj) => obj.result); } /** * Executes a semantic search query against an AI Search instance to find relevant * indexed content. * * Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances * (and descendant paths) instead. * * @deprecated */ search(id, params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/ai-search/instances/${id}/search`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Retrieve usage and indexing statistics for an AI Search instance. * * Deprecated: use /accounts/{account_id}/ai-search/namespaces/{name}/instances * (and descendant paths) instead. * * @deprecated */ stats(id, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/ai-search/instances/${id}/stats`, options)._thenUnwrap((obj) => obj.result); } } BaseInstances._key = Object.freeze([ 'aiSearch', 'instances', ]); return BaseInstances; })(); exports.BaseInstances = BaseInstances; var Instances = /* @__PURE__ */ (() => { class Instances extends BaseInstances { constructor() { super(...arguments); this.jobs = new JobsAPI.Jobs(this._client); } } Instances.Jobs = jobs_1.Jobs; Instances.BaseJobs = jobs_1.BaseJobs; return Instances; })(); exports.Instances = Instances; //# sourceMappingURL=instances.js.map