UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

51 lines • 1.98 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 BaseBinaryStorage = /* @__PURE__ */ (() => { class BaseBinaryStorage extends 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(path `/accounts/${account_id}/cloudforce-one/binary`, 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(path `/accounts/${account_id}/cloudforce-one/binary/${hash}`, { ...options, headers: buildHeaders([{ Accept: '*/*' }, options?.headers]), }); } } BaseBinaryStorage._key = Object.freeze([ 'cloudforceOne', 'binaryStorage', ]); return BaseBinaryStorage; })(); export class BinaryStorage extends BaseBinaryStorage { } //# sourceMappingURL=binary-storage.mjs.map