UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

110 lines • 3.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Queries = exports.BaseQueries = void 0; // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../core/resource.js"); const headers_1 = require("../../../internal/headers.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseQueries = /* @__PURE__ */ (() => { class BaseQueries extends resource_1.APIResource { /** * Create a new saved event query for the account * * @example * ```ts * const query = * await client.cloudforceOne.threatEvents.queries.create({ * account_id: 'account_id', * alert_enabled: true, * alert_rollup_enabled: true, * name: 'name', * query_json: 'query_json', * rule_enabled: true, * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/queries/create`, { body, ...options, }); } /** * Retrieve all saved event queries for the account * * @example * ```ts * const queries = * await client.cloudforceOne.threatEvents.queries.list({ * account_id: 'account_id', * }); * ``` */ list(params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/queries`, options); } /** * Delete a saved event query by its ID * * @example * ```ts * await client.cloudforceOne.threatEvents.queries.delete(0, { * account_id: 'account_id', * }); * ``` */ delete(queryID, params, options) { const { account_id } = params; return this._client.delete((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/queries/${queryID}`, { ...options, headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]), }); } /** * Update an existing saved event query by its ID * * @example * ```ts * const response = * await client.cloudforceOne.threatEvents.queries.edit(0, { * account_id: 'account_id', * }); * ``` */ edit(queryID, params, options) { const { account_id, ...body } = params; return this._client.patch((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/queries/${queryID}`, { body, ...options, }); } /** * Retrieve a saved event query by its ID * * @example * ```ts * const query = * await client.cloudforceOne.threatEvents.queries.get(0, { * account_id: 'account_id', * }); * ``` */ get(queryID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cloudforce-one/events/queries/${queryID}`, options); } } BaseQueries._key = Object.freeze([ 'cloudforceOne', 'threatEvents', 'queries', ]); return BaseQueries; })(); exports.BaseQueries = BaseQueries; class Queries extends BaseQueries { } exports.Queries = Queries; //# sourceMappingURL=queries.js.map