UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

127 lines • 4.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Feeds = exports.BaseFeeds = void 0; const tslib_1 = require("../../../../internal/tslib.js"); // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. const resource_1 = require("../../../../core/resource.js"); const RawAPI = tslib_1.__importStar(require("./raw.js")); const raw_1 = require("./raw.js"); const SkillsAPI = tslib_1.__importStar(require("./skills.js")); const skills_1 = require("./skills.js"); const pagination_1 = require("../../../../core/pagination.js"); const path_1 = require("../../../../internal/utils/path.js"); var BaseFeeds = /* @__PURE__ */ (() => { class BaseFeeds extends resource_1.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((0, path_1.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((0, path_1.path) `/accounts/${account_id}/cloudforce-one/v2/threat-signals/feeds`, (pagination_1.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((0, path_1.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((0, path_1.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((0, path_1.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; })(); exports.BaseFeeds = BaseFeeds; 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_1.Raw; Feeds.BaseRaw = raw_1.BaseRaw; Feeds.Skills = skills_1.Skills; Feeds.BaseSkills = skills_1.BaseSkills; return Feeds; })(); exports.Feeds = Feeds; //# sourceMappingURL=feeds.js.map