cloudflare
Version:
The official TypeScript library for the Cloudflare API
124 lines • 4.8 kB
JavaScript
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from "../../../core/resource.mjs";
import * as DownloadsAPI from "./downloads.mjs";
import { BaseDownloads, Downloads } from "./downloads.mjs";
import * as PermissionsAPI from "./permissions.mjs";
import { BasePermissions, Permissions, } from "./permissions.mjs";
import * as SnapshotsAPI from "./snapshots.mjs";
import { BaseSnapshots, Snapshots } from "./snapshots.mjs";
import { SinglePage } from "../../../core/pagination.mjs";
import { buildHeaders } from "../../../internal/headers.mjs";
import { path } from "../../../internal/utils/path.mjs";
export var BaseIndicatorFeeds = /* @__PURE__ */ (() => {
class BaseIndicatorFeeds extends 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(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(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(path `/accounts/${account_id}/intel/indicator-feeds`, (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(path `/accounts/${account_id}/intel/indicator-feeds/${feedID}/data`, {
...options,
headers: 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(path `/accounts/${account_id}/intel/indicator-feeds/${feedID}`, options)._thenUnwrap((obj) => obj.result);
}
}
BaseIndicatorFeeds._key = Object.freeze([
'intel',
'indicatorFeeds',
]);
return BaseIndicatorFeeds;
})();
export 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;
IndicatorFeeds.BaseSnapshots = BaseSnapshots;
IndicatorFeeds.Permissions = Permissions;
IndicatorFeeds.BasePermissions = BasePermissions;
IndicatorFeeds.Downloads = Downloads;
IndicatorFeeds.BaseDownloads = BaseDownloads;
return IndicatorFeeds;
})();
//# sourceMappingURL=indicator-feeds.mjs.map