cloudflare
Version:
The official TypeScript library for the Cloudflare API
57 lines • 2.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Snapshots = exports.BaseSnapshots = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../core/resource.js");
const headers_1 = require("../../../internal/headers.js");
const uploads_1 = require("../../../internal/uploads.js");
const path_1 = require("../../../internal/utils/path.js");
var BaseSnapshots = /* @__PURE__ */ (() => {
class BaseSnapshots extends resource_1.APIResource {
/**
* Revises the raw data entries in a custom threat indicator feed.
*
* Accepts both plain and gzipped STIX2/CRDF bodies. Gzip is detected by RFC 1952
* magic bytes (`0x1f 0x8b`) and/or a `.gz` filename suffix (case-insensitive) —
* either signal alone is sufficient to trigger the gzip path; if the body is not
* valid gzip, the upload fails fast. Customers are encouraged to gzip larger
* uploads — the api-gateway 500 MB body cap applies to the on-the-wire
* (compressed) size, so gzip lets a single upload carry several GiB of
* decompressed STIX.
*
* @example
* ```ts
* const snapshot =
* await client.intel.indicatorFeeds.snapshots.update(12, {
* account_id: '023e105f4ecef8ad9ca31a8372d0c353',
* });
* ```
*/
update(feedID, params, options) {
const { account_id, 'Cf-Async-Upload': cfAsyncUpload, ...body } = params;
return this._client.put((0, path_1.path) `/accounts/${account_id}/intel/indicator-feeds/${feedID}/snapshot`, (0, uploads_1.multipartFormRequestOptions)({
body,
...options,
headers: (0, headers_1.buildHeaders)([
{
...(cfAsyncUpload?.toString() != null ?
{ 'Cf-Async-Upload': cfAsyncUpload?.toString() }
: undefined),
},
options?.headers,
]),
}, this._client))._thenUnwrap((obj) => obj.result);
}
}
BaseSnapshots._key = Object.freeze([
'intel',
'indicatorFeeds',
'snapshots',
]);
return BaseSnapshots;
})();
exports.BaseSnapshots = BaseSnapshots;
class Snapshots extends BaseSnapshots {
}
exports.Snapshots = Snapshots;
//# sourceMappingURL=snapshots.js.map