UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

104 lines • 3.93 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 { path } from "../../../internal/utils/path.mjs"; export var BaseProxyEndpoints = /* @__PURE__ */ (() => { class BaseProxyEndpoints extends APIResource { /** * Create a new Zero Trust Gateway proxy endpoint. * * @example * ```ts * const proxyEndpoint = * await client.zeroTrust.gateway.proxyEndpoints.create({ * account_id: '699d98642c564d2e855e9661899b7252', * name: 'Devops team', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/gateway/proxy_endpoints`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * List all Zero Trust Gateway proxy endpoints for an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const proxyEndpoint of client.zeroTrust.gateway.proxyEndpoints.list( * { account_id: '699d98642c564d2e855e9661899b7252' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList(path `/accounts/${account_id}/gateway/proxy_endpoints`, (SinglePage), { query, ...options }); } /** * Delete a configured Zero Trust Gateway proxy endpoint. * * @example * ```ts * const proxyEndpoint = * await client.zeroTrust.gateway.proxyEndpoints.delete( * 'ed35569b41ce4d1facfe683550f54086', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ delete(proxyEndpointID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/gateway/proxy_endpoints/${proxyEndpointID}`, options)._thenUnwrap((obj) => obj.result); } /** * Update a configured Zero Trust Gateway proxy endpoint. * * @example * ```ts * const proxyEndpoint = * await client.zeroTrust.gateway.proxyEndpoints.edit( * 'ed35569b41ce4d1facfe683550f54086', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ edit(proxyEndpointID, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/gateway/proxy_endpoints/${proxyEndpointID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Get a single Zero Trust Gateway proxy endpoint. * * @example * ```ts * const proxyEndpoint = * await client.zeroTrust.gateway.proxyEndpoints.get( * 'ed35569b41ce4d1facfe683550f54086', * { account_id: '699d98642c564d2e855e9661899b7252' }, * ); * ``` */ get(proxyEndpointID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/gateway/proxy_endpoints/${proxyEndpointID}`, options)._thenUnwrap((obj) => obj.result); } } BaseProxyEndpoints._key = Object.freeze([ 'zeroTrust', 'gateway', 'proxyEndpoints', ]); return BaseProxyEndpoints; })(); export class ProxyEndpoints extends BaseProxyEndpoints { } //# sourceMappingURL=proxy-endpoints.mjs.map