cloudflare
Version:
The official TypeScript library for the Cloudflare API
107 lines • 3.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Rules = exports.BaseRules = 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 BaseRules = /* @__PURE__ */ (() => {
class BaseRules extends resource_1.APIResource {
/**
* Create a DEX Rule.
*
* @example
* ```ts
* const rule = await client.zeroTrust.dex.rules.create({
* account_id: '01a7362d577a6c3019a474fd6f485823',
* match: 'match',
* name: 'name',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/dex/rules`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Update a DEX Rule.
*
* @example
* ```ts
* const rule = await client.zeroTrust.dex.rules.update(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* );
* ```
*/
update(ruleID, params, options) {
const { account_id, ...body } = params;
return this._client.patch((0, path_1.path) `/accounts/${account_id}/dex/rules/${ruleID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* List DEX Rules.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const ruleListResponse of client.zeroTrust.dex.rules.list(
* {
* account_id: '01a7362d577a6c3019a474fd6f485823',
* page: 1,
* per_page: 10,
* },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/dex/rules`, (pagination_1.V4PagePagination), { query, ...options });
}
/**
* Delete a DEX Rule.
*
* @example
* ```ts
* const rule = await client.zeroTrust.dex.rules.delete(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* );
* ```
*/
delete(ruleID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/dex/rules/${ruleID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Get details for a DEX Rule.
*
* @example
* ```ts
* const rule = await client.zeroTrust.dex.rules.get(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '01a7362d577a6c3019a474fd6f485823' },
* );
* ```
*/
get(ruleID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/dex/rules/${ruleID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseRules._key = Object.freeze([
'zeroTrust',
'dex',
'rules',
]);
return BaseRules;
})();
exports.BaseRules = BaseRules;
class Rules extends BaseRules {
}
exports.Rules = Rules;
//# sourceMappingURL=rules.js.map