UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

104 lines • 3.96 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../../core/resource.mjs"; import { V4PagePaginationArray, } from "../../../../../core/pagination.mjs"; import { path } from "../../../../../internal/utils/path.mjs"; export var BasePortals = /* @__PURE__ */ (() => { class BasePortals extends 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(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(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(path `/accounts/${account_id}/access/ai-controls/mcp/portals`, (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(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(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; })(); export class Portals extends BasePortals { } //# sourceMappingURL=portals.mjs.map