UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

106 lines • 4.17 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../core/resource.mjs"; import * as CancelAPI from "./cancel.mjs"; import { BaseCancel, Cancel } from "./cancel.mjs"; import * as MessagesAPI from "./messages.mjs"; import { BaseMessages, Messages, } from "./messages.mjs"; import { V4PagePaginationArray, } from "../../../../core/pagination.mjs"; import { path } from "../../../../internal/utils/path.mjs"; export var BaseBulk = /* @__PURE__ */ (() => { class BaseBulk extends 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(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(path `/accounts/${account_id}/email-security/investigate/bulk`, (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(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(path `/accounts/${account_id}/email-security/investigate/bulk/${jobID}`, options)._thenUnwrap((obj) => obj.result); } } BaseBulk._key = Object.freeze([ 'emailSecurity', 'investigate', 'bulk', ]); return BaseBulk; })(); export 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; Bulk.BaseCancel = BaseCancel; Bulk.Messages = Messages; Bulk.BaseMessages = BaseMessages; return Bulk; })(); //# sourceMappingURL=bulk.mjs.map