cloudflare
Version:
The official TypeScript library for the Cloudflare API
105 lines • 3.51 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import { buildHeaders } from "../../../internal/headers.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseQueries = /* @__PURE__ */ (() => {
class BaseQueries extends 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(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(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(path `/accounts/${account_id}/cloudforce-one/events/queries/${queryID}`, {
...options,
headers: 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(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(path `/accounts/${account_id}/cloudforce-one/events/queries/${queryID}`, options);
}
}
BaseQueries._key = Object.freeze([
'cloudforceOne',
'threatEvents',
'queries',
]);
return BaseQueries;
})();
export class Queries extends BaseQueries {
}
//# sourceMappingURL=queries.mjs.map