cloudflare
Version:
The official TypeScript library for the Cloudflare API
112 lines • 4.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Bulk = exports.BaseBulk = 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 CancelAPI = tslib_1.__importStar(require("./cancel.js"));
const cancel_1 = require("./cancel.js");
const MessagesAPI = tslib_1.__importStar(require("./messages.js"));
const messages_1 = require("./messages.js");
const pagination_1 = require("../../../../core/pagination.js");
const path_1 = require("../../../../internal/utils/path.js");
var BaseBulk = /* @__PURE__ */ (() => {
class BaseBulk extends resource_1.APIResource {
/**
* Creates a new bulk action job to move or release messages that match the
* provided search parameters. To move or release an explicit list of known
* messages instead of a search, use the move or release endpoints.
*
* @example
* ```ts
* const bulk =
* await client.emailSecurity.investigate.bulk.create({
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* action: 'MOVE',
* search_params: {},
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post((0, path_1.path) `/accounts/${account_id}/email-security/investigate/bulk`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Returns a paginated list of bulk action jobs for the account.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const bulkListResponse of client.emailSecurity.investigate.bulk.list(
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/email-security/investigate/bulk`, (pagination_1.V4PagePaginationArray), { query, ...options });
}
/**
* Deletes the job, removing it from all list and detail endpoints. Only jobs in a
* terminal state (`COMPLETED`, `CANCELLED`, or `FAILED`) can be deleted. To stop
* an in-progress job without removing it, use the cancel endpoint instead.
*
* @example
* ```ts
* const bulk =
* await client.emailSecurity.investigate.bulk.delete(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
delete(jobID, params, options) {
const { account_id } = params;
return this._client.delete((0, path_1.path) `/accounts/${account_id}/email-security/investigate/bulk/${jobID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Returns the status and details of a specific bulk action job.
*
* @example
* ```ts
* const bulk =
* await client.emailSecurity.investigate.bulk.get(
* 'f174e90a-fafe-4643-bbbc-4a0ed4fc8415',
* { account_id: '023e105f4ecef8ad9ca31a8372d0c353' },
* );
* ```
*/
get(jobID, params, options) {
const { account_id } = params;
return this._client.get((0, path_1.path) `/accounts/${account_id}/email-security/investigate/bulk/${jobID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseBulk._key = Object.freeze([
'emailSecurity',
'investigate',
'bulk',
]);
return BaseBulk;
})();
exports.BaseBulk = BaseBulk;
var Bulk = /* @__PURE__ */ (() => {
class Bulk extends BaseBulk {
constructor() {
super(...arguments);
this.cancel = new CancelAPI.Cancel(this._client);
this.messages = new MessagesAPI.Messages(this._client);
}
}
Bulk.Cancel = cancel_1.Cancel;
Bulk.BaseCancel = cancel_1.BaseCancel;
Bulk.Messages = messages_1.Messages;
Bulk.BaseMessages = messages_1.BaseMessages;
return Bulk;
})();
exports.Bulk = Bulk;
//# sourceMappingURL=bulk.js.map