cloudflare
Version:
The official TypeScript library for the Cloudflare API
68 lines • 2.4 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../core/resource.mjs";
import * as CustomAPI from "./custom.mjs";
import { BaseCustom, Custom, } from "./custom.mjs";
import * as PredefinedAPI from "./predefined.mjs";
import { BasePredefined, Predefined, } from "./predefined.mjs";
import { SinglePage } from "../../../../core/pagination.mjs";
import { path } from "../../../../internal/utils/path.mjs";
export var BaseProfiles = /* @__PURE__ */ (() => {
class BaseProfiles extends 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(path `/accounts/${account_id}/dlp/profiles`, (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(path `/accounts/${account_id}/dlp/profiles/${profileID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseProfiles._key = Object.freeze([
'zeroTrust',
'dlp',
'profiles',
]);
return BaseProfiles;
})();
export 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;
Profiles.BaseCustom = BaseCustom;
Profiles.Predefined = Predefined;
Profiles.BasePredefined = BasePredefined;
return Profiles;
})();
//# sourceMappingURL=profiles.mjs.map