UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

52 lines • 2.29 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from "../../../core/resource.mjs"; import { buildHeaders } from "../../../internal/headers.mjs"; import { multipartFormRequestOptions } from "../../../internal/uploads.mjs"; import { path } from "../../../internal/utils/path.mjs"; export var BaseSnapshots = /* @__PURE__ */ (() => { class BaseSnapshots extends 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(path `/accounts/${account_id}/intel/indicator-feeds/${feedID}/snapshot`, multipartFormRequestOptions({ body, ...options, headers: 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; })(); export class Snapshots extends BaseSnapshots { } //# sourceMappingURL=snapshots.mjs.map