UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

130 lines • 5.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.IndicatorFeeds = exports.BaseIndicatorFeeds = 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 DownloadsAPI = tslib_1.__importStar(require("./downloads.js")); const downloads_1 = require("./downloads.js"); const PermissionsAPI = tslib_1.__importStar(require("./permissions.js")); const permissions_1 = require("./permissions.js"); const SnapshotsAPI = tslib_1.__importStar(require("./snapshots.js")); const snapshots_1 = require("./snapshots.js"); const pagination_1 = require("../../../core/pagination.js"); const headers_1 = require("../../../internal/headers.js"); const path_1 = require("../../../internal/utils/path.js"); var BaseIndicatorFeeds = /* @__PURE__ */ (() => { class BaseIndicatorFeeds extends resource_1.APIResource { /** * Creates a new custom threat indicator feed for sharing threat intelligence data. * * @example * ```ts * const indicatorFeed = * await client.intel.indicatorFeeds.create({ * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/intel/indicator-feeds`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Revises details for a specific custom threat indicator feed. * * @example * ```ts * const indicatorFeed = * await client.intel.indicatorFeeds.update(12, { * account_id: '023e105f4ecef8ad9ca31a8372d0c353', * }); * ``` */ update(feedID, params, options) { const { account_id, ...body } = params; return this._client.put((0, path_1.path) `/accounts/${account_id}/intel/indicator-feeds/${feedID}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Retrieves details for all accessible custom threat indicator feeds. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const indicatorFeedListResponse of client.intel.indicatorFeeds.list( * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * )) { * // ... * } * ``` */ list(params, options) { const { account_id } = params; return this._client.getAPIList((0, path_1.path) `/accounts/${account_id}/intel/indicator-feeds`, (pagination_1.SinglePage), options); } /** * Retrieves the raw data entries in a custom threat indicator feed. * * @example * ```ts * const response = await client.intel.indicatorFeeds.data( * 12, * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ data(feedID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/intel/indicator-feeds/${feedID}/data`, { ...options, headers: (0, headers_1.buildHeaders)([{ Accept: 'text/csv' }, options?.headers]), }); } /** * Retrieves details for a specific custom threat indicator feed. * * @example * ```ts * const indicatorFeed = await client.intel.indicatorFeeds.get( * 12, * { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, * ); * ``` */ get(feedID, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/intel/indicator-feeds/${feedID}`, options)._thenUnwrap((obj) => obj.result); } } BaseIndicatorFeeds._key = Object.freeze([ 'intel', 'indicatorFeeds', ]); return BaseIndicatorFeeds; })(); exports.BaseIndicatorFeeds = BaseIndicatorFeeds; var IndicatorFeeds = /* @__PURE__ */ (() => { class IndicatorFeeds extends BaseIndicatorFeeds { constructor() { super(...arguments); this.snapshots = new SnapshotsAPI.Snapshots(this._client); this.permissions = new PermissionsAPI.Permissions(this._client); this.downloads = new DownloadsAPI.Downloads(this._client); } } IndicatorFeeds.Snapshots = snapshots_1.Snapshots; IndicatorFeeds.BaseSnapshots = snapshots_1.BaseSnapshots; IndicatorFeeds.Permissions = permissions_1.Permissions; IndicatorFeeds.BasePermissions = permissions_1.BasePermissions; IndicatorFeeds.Downloads = downloads_1.Downloads; IndicatorFeeds.BaseDownloads = downloads_1.BaseDownloads; return IndicatorFeeds; })(); exports.IndicatorFeeds = IndicatorFeeds; //# sourceMappingURL=indicator-feeds.js.map