cloudflare
Version:
The official TypeScript library for the Cloudflare API
87 lines • 3.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Commands = exports.BaseCommands = 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 DevicesAPI = tslib_1.__importStar(require("./devices.js"));
const devices_1 = require("./devices.js");
const DownloadsAPI = tslib_1.__importStar(require("./downloads.js"));
const downloads_1 = require("./downloads.js");
const QuotaAPI = tslib_1.__importStar(require("./quota.js"));
const quota_1 = require("./quota.js");
const pagination_1 = require("../../../../core/pagination.js");
const path_1 = require("../../../../internal/utils/path.js");
var BaseCommands = /* @__PURE__ */ (() => {
class BaseCommands extends resource_1.APIResource {
/**
* Initiate commands for up to 10 devices per account.
*
* @example
* ```ts
* const command = await client.zeroTrust.dex.commands.create({
* account_id: '01a7362d577a6c3019a474fd6f485823',
* commands: [
* {
* device_id: 'device_id',
* type: 'pcap',
* user_email: 'user_email',
* },
* ],
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/dex/commands`, { body, ...options })._thenUnwrap((obj) => obj.result);
}
/**
* Retrieves a paginated list of commands issued to devices under the specified
* account, optionally filtered by time range, device, or other parameters
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const commandListResponse of client.zeroTrust.dex.commands.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/commands`, (pagination_1.V4PagePagination), { query, ...options });
}
}
BaseCommands._key = Object.freeze([
'zeroTrust',
'dex',
'commands',
]);
return BaseCommands;
})();
exports.BaseCommands = BaseCommands;
var Commands = /* @__PURE__ */ (() => {
class Commands extends BaseCommands {
constructor() {
super(...arguments);
this.devices = new DevicesAPI.Devices(this._client);
this.downloads = new DownloadsAPI.Downloads(this._client);
this.quota = new QuotaAPI.Quota(this._client);
}
}
Commands.Devices = devices_1.Devices;
Commands.BaseDevices = devices_1.BaseDevices;
Commands.Downloads = downloads_1.Downloads;
Commands.BaseDownloads = downloads_1.BaseDownloads;
Commands.Quota = quota_1.Quota;
Commands.BaseQuota = quota_1.BaseQuota;
return Commands;
})();
exports.Commands = Commands;
//# sourceMappingURL=commands.js.map