UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

109 lines • 4.2 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Portals = exports.BasePortals = 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 path_1 = require("../../../../../internal/utils/path.js"); var BasePortals = /* @__PURE__ */ (() => { class BasePortals extends resource_1.APIResource { /** * Creates a new MCP portal for managing AI tool access through Cloudflare Access. * * @example * ```ts * const portal = * await client.zeroTrust.access.aiControls.mcp.portals.create( * { * account_id: 'a86a8f5c339544d7bdc89926de14fb8c', * id: 'my-mcp-portal', * hostname: 'example.com', * name: 'My MCP Portal', * }, * ); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/access/ai-controls/mcp/portals`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Updates an MCP portal configuration. * * @example * ```ts * const portal = * await client.zeroTrust.access.aiControls.mcp.portals.update( * 'my-mcp-portal', * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * ); * ``` */ update(id, params, options) { const { account_id, ...body } = params; return this._client.put((0, path_1.path) `/accounts/${account_id}/access/ai-controls/mcp/portals/${id}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Lists all MCP portals configured for the account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const portalListResponse of client.zeroTrust.access.aiControls.mcp.portals.list( * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/access/ai-controls/mcp/portals`, (pagination_1.V4PagePaginationArray), { query, ...options }); } /** * Deletes an MCP portal from the account. * * @example * ```ts * const portal = * await client.zeroTrust.access.aiControls.mcp.portals.delete( * 'my-mcp-portal', * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * ); * ``` */ delete(id, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/access/ai-controls/mcp/portals/${id}`, options)._thenUnwrap((obj) => obj.result); } /** * Read the details of a single MCP Portal, including its configured servers. * * @example * ```ts * const response = * await client.zeroTrust.access.aiControls.mcp.portals.read( * 'my-mcp-portal', * { account_id: 'a86a8f5c339544d7bdc89926de14fb8c' }, * ); * ``` */ read(id, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/access/ai-controls/mcp/portals/${id}`, options)._thenUnwrap((obj) => obj.result); } } BasePortals._key = Object.freeze(['zeroTrust', 'access', 'aiControls', 'mcp', 'portals']); return BasePortals; })(); exports.BasePortals = BasePortals; class Portals extends BasePortals { } exports.Portals = Portals; //# sourceMappingURL=portals.js.map