UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

74 lines • 2.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Profiles = exports.BaseProfiles = 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 CustomAPI = tslib_1.__importStar(require("./custom.js")); const custom_1 = require("./custom.js"); const PredefinedAPI = tslib_1.__importStar(require("./predefined.js")); const predefined_1 = require("./predefined.js"); const pagination_1 = require("../../../../core/pagination.js"); const path_1 = require("../../../../internal/utils/path.js"); var BaseProfiles = /* @__PURE__ */ (() => { class BaseProfiles extends resource_1.APIResource { /** * Lists all DLP profiles in an account. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const profile of client.zeroTrust.dlp.profiles.list( * { account_id: 'account_id' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/dlp/profiles`, (pagination_1.SinglePage), { query, ...options, }); } /** * Fetches a DLP profile by ID. * * @example * ```ts * const profile = await client.zeroTrust.dlp.profiles.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ get(profileID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/dlp/profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result); } } BaseProfiles._key = Object.freeze([ 'zeroTrust', 'dlp', 'profiles', ]); return BaseProfiles; })(); exports.BaseProfiles = BaseProfiles; var Profiles = /* @__PURE__ */ (() => { class Profiles extends BaseProfiles { constructor() { super(...arguments); this.custom = new CustomAPI.Custom(this._client); this.predefined = new PredefinedAPI.Predefined(this._client); } } Profiles.Custom = custom_1.Custom; Profiles.BaseCustom = custom_1.BaseCustom; Profiles.Predefined = predefined_1.Predefined; Profiles.BasePredefined = predefined_1.BasePredefined; return Profiles; })(); exports.Profiles = Profiles; //# sourceMappingURL=profiles.js.map