UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

61 lines 2.3 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import * as DatasetsAPI from 'cloudflare/resources/zero-trust/dlp/datasets/datasets'; import * as UploadAPI from 'cloudflare/resources/zero-trust/dlp/datasets/upload'; import { SinglePage } from 'cloudflare/pagination'; export class Datasets extends APIResource { constructor() { super(...arguments); this.upload = new UploadAPI.Upload(this._client); } /** * Create a new dataset. */ create(params, options) { const { account_id, ...body } = params; return this._client.post(`/accounts/${account_id}/dlp/datasets`, { body, ...options })._thenUnwrap((obj) => obj.result); } /** * Update details about a dataset. */ update(datasetId, params, options) { const { account_id, ...body } = params; return this._client.put(`/accounts/${account_id}/dlp/datasets/${datasetId}`, { body, ...options, })._thenUnwrap((obj) => obj.result); } /** * Fetch all datasets with information about available versions. */ list(params, options) { const { account_id } = params; return this._client.getAPIList(`/accounts/${account_id}/dlp/datasets`, DLPDatasetsSinglePage, options); } /** * Delete a dataset. * * This deletes all versions of the dataset. */ delete(datasetId, params, options) { const { account_id } = params; return this._client.delete(`/accounts/${account_id}/dlp/datasets/${datasetId}`, { ...options, headers: { Accept: '*/*', ...options?.headers }, }); } /** * Fetch a specific dataset with information about available versions. */ get(datasetId, params, options) { const { account_id } = params; return this._client.get(`/accounts/${account_id}/dlp/datasets/${datasetId}`, options)._thenUnwrap((obj) => obj.result); } } export class DLPDatasetsSinglePage extends SinglePage { } (function (Datasets) { Datasets.DLPDatasetsSinglePage = DatasetsAPI.DLPDatasetsSinglePage; Datasets.Upload = UploadAPI.Upload; })(Datasets || (Datasets = {})); //# sourceMappingURL=datasets.mjs.map