cloudflare
Version:
The official TypeScript library for the Cloudflare API
121 lines • 4.35 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../../core/resource.mjs";
import * as RawAPI from "./raw.mjs";
import { BaseRaw, Raw } from "./raw.mjs";
import * as SkillsAPI from "./skills.mjs";
import { BaseSkills, Skills, } from "./skills.mjs";
import { V4PagePagination } from "../../../../core/pagination.mjs";
import { path } from "../../../../internal/utils/path.mjs";
export var BaseFeeds = /* @__PURE__ */ (() => {
class BaseFeeds extends APIResource {
/**
* Subscribes the account to a custom or curated Threat Signals feed.
*
* @example
* ```ts
* const feed =
* await client.cloudforceOne.threatSignals.feeds.create({
* account_id: 'account_id',
* });
* ```
*/
create(params, options) {
const { account_id, ...body } = params;
return this._client.post(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/feeds`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Lists the account's Threat Signals feed subscriptions.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const feedListResponse of client.cloudforceOne.threatSignals.feeds.list(
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(params, options) {
const { account_id, ...query } = params;
return this._client.getAPIList(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/feeds`, (V4PagePagination), { query, ...options });
}
/**
* Unsubscribes the account from a Threat Signals feed and deletes its articles.
*
* @example
* ```ts
* const feed =
* await client.cloudforceOne.threatSignals.feeds.delete(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id' },
* );
* ```
*/
delete(feedID, params, options) {
const { account_id } = params;
return this._client.delete(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/feeds/${feedID}`, options)._thenUnwrap((obj) => obj.result);
}
/**
* Updates a Threat Signals feed subscription.
*
* @example
* ```ts
* const response =
* await client.cloudforceOne.threatSignals.feeds.edit(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* { account_id: 'account_id' },
* );
* ```
*/
edit(feedID, params, options) {
const { account_id, ...body } = params;
return this._client.patch(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/feeds/${feedID}`, {
body,
...options,
})._thenUnwrap((obj) => obj.result);
}
/**
* Starts an immediate poll of one or all Threat Signals feeds.
*
* @example
* ```ts
* const response =
* await client.cloudforceOne.threatSignals.feeds.poll({
* account_id: 'account_id',
* });
* ```
*/
poll(params, options) {
const { account_id, feed_id } = params;
return this._client.post(path `/accounts/${account_id}/cloudforce-one/v2/threat-signals/feeds/poll`, {
query: { feed_id },
...options,
})._thenUnwrap((obj) => obj.result);
}
}
BaseFeeds._key = Object.freeze([
'cloudforceOne',
'threatSignals',
'feeds',
]);
return BaseFeeds;
})();
export var Feeds = /* @__PURE__ */ (() => {
class Feeds extends BaseFeeds {
constructor() {
super(...arguments);
this.raw = new RawAPI.Raw(this._client);
this.skills = new SkillsAPI.Skills(this._client);
}
}
Feeds.Raw = Raw;
Feeds.BaseRaw = BaseRaw;
Feeds.Skills = Skills;
Feeds.BaseSkills = BaseSkills;
return Feeds;
})();
//# sourceMappingURL=feeds.mjs.map