UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

137 lines • 4.86 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../../core/resource.mjs"; import * as EventsAPI from "./events.mjs"; import { BaseEvents, Events } from "./events.mjs"; import * as HealthAPI from "./health.mjs"; import { BaseHealth, Health } from "./health.mjs"; import { path } from "../../../../internal/utils/path.mjs"; export var BaseDatasets = /* @__PURE__ */ (() => { class BaseDatasets extends APIResource { /** * Creates a new threat event dataset in Cloudforce One for organizing related * threat events. * * @example * ```ts * const dataset = * await client.cloudforceOne.threatEvents.datasets.create({ * account_id: 'account_id', * isPublic: true, * name: 'x', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post(path `/accounts/${account_id}/cloudforce-one/events/dataset/create`, { body, ...options, }); } /** * Lists all threat event datasets configured in Cloudforce One. * * @example * ```ts * const datasets = * await client.cloudforceOne.threatEvents.datasets.list({ * account_id: 'account_id', * }); * ``` */ list(params, options) { const { account_id, ...query } = params; return this._client.get(path `/accounts/${account_id}/cloudforce-one/events/dataset`, { query, ...options, }); } /** * Soft-deletes a dataset given a datasetId. * * @example * ```ts * const dataset = * await client.cloudforceOne.threatEvents.datasets.delete( * 'dataset_id', * { account_id: 'account_id' }, * ); * ``` */ delete(datasetID, params, options) { const { account_id } = params; return this._client.delete(path `/accounts/${account_id}/cloudforce-one/events/dataset/${datasetID}`, options); } /** * Partially updates a threat event dataset in Cloudforce One, modifying specific * fields without replacing the entire dataset configuration. * * @example * ```ts * const response = * await client.cloudforceOne.threatEvents.datasets.edit( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { * account_id: 'account_id', * isPublic: true, * name: 'x', * }, * ); * ``` */ edit(datasetID, params, options) { const { account_id, ...body } = params; return this._client.patch(path `/accounts/${account_id}/cloudforce-one/events/dataset/${datasetID}`, { body, ...options, }); } /** * Retrieves details for a specific threat event dataset. * * @example * ```ts * const dataset = * await client.cloudforceOne.threatEvents.datasets.get( * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', * { account_id: 'account_id' }, * ); * ``` */ get(datasetID, params, options) { const { account_id } = params; return this._client.get(path `/accounts/${account_id}/cloudforce-one/events/dataset/${datasetID}`, options); } /** * Deprecated; use GET /events/datasets/{dataset_id}/events/{event_id}/raw. * Available through 2026-11-28. * * @deprecated Use GET /events/datasets/{dataset_id}/events/{event_id}/raw before 2026-11-28. */ raw(eventID, params, options) { const { account_id, dataset_id } = params; return this._client.get(path `/accounts/${account_id}/cloudforce-one/events/raw/${dataset_id}/${eventID}`, options); } } BaseDatasets._key = Object.freeze([ 'cloudforceOne', 'threatEvents', 'datasets', ]); return BaseDatasets; })(); export var Datasets = /* @__PURE__ */ (() => { class Datasets extends BaseDatasets { constructor() { super(...arguments); this.health = new HealthAPI.Health(this._client); this.events = new EventsAPI.Events(this._client); } } Datasets.Health = Health; Datasets.BaseHealth = BaseHealth; Datasets.Events = Events; Datasets.BaseEvents = BaseEvents; return Datasets; })(); //# sourceMappingURL=datasets.mjs.map