UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

56 lines • 2.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BinaryStorage = exports.BaseBinaryStorage = 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 BaseBinaryStorage = /* @__PURE__ */ (() => { class BaseBinaryStorage extends resource_1.APIResource { /** * Uploads a binary file to Cloudforce One's binary database for malware analysis * and threat intelligence correlation. * * @example * ```ts * const binaryStorage = * await client.cloudforceOne.binaryStorage.create({ * account_id: 'account_id', * file: fs.createReadStream('path/to/file'), * }); * ``` */ create(params, options) { const { account_id, ...body } = params; return this._client.post((0, path_1.path) `/accounts/${account_id}/cloudforce-one/binary`, (0, uploads_1.multipartFormRequestOptions)({ body, ...options }, this._client)); } /** * Retrieves a binary file from the Cloudforce One binary storage for analysis. * * @example * ```ts * await client.cloudforceOne.binaryStorage.get('hash', { * account_id: 'account_id', * }); * ``` */ get(hash, params, options) { const { account_id } = params; return this._client.get((0, path_1.path) `/accounts/${account_id}/cloudforce-one/binary/${hash}`, { ...options, headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]), }); } } BaseBinaryStorage._key = Object.freeze([ 'cloudforceOne', 'binaryStorage', ]); return BaseBinaryStorage; })(); exports.BaseBinaryStorage = BaseBinaryStorage; class BinaryStorage extends BaseBinaryStorage { } exports.BinaryStorage = BinaryStorage; //# sourceMappingURL=binary-storage.js.map