cloudflare
Version:
The official TypeScript library for the Cloudflare API
81 lines • 3 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../core/resource.mjs";
import * as DevicesAPI from "./devices.mjs";
import { BaseDevices, Devices, } from "./devices.mjs";
import * as DownloadsAPI from "./downloads.mjs";
import { BaseDownloads, Downloads } from "./downloads.mjs";
import * as QuotaAPI from "./quota.mjs";
import { BaseQuota, Quota } from "./quota.mjs";
import { V4PagePagination } from "../../../../core/pagination.mjs";
import { path } from "../../../../internal/utils/path.mjs";
export var BaseCommands = /* @__PURE__ */ (() => {
class BaseCommands extends 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(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(path `/accounts/${account_id}/dex/commands`, (V4PagePagination), { query, ...options });
}
}
BaseCommands._key = Object.freeze([
'zeroTrust',
'dex',
'commands',
]);
return BaseCommands;
})();
export 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;
Commands.BaseDevices = BaseDevices;
Commands.Downloads = Downloads;
Commands.BaseDownloads = BaseDownloads;
Commands.Quota = Quota;
Commands.BaseQuota = BaseQuota;
return Commands;
})();
//# sourceMappingURL=commands.mjs.map