UNPKG

cloudflare

Version:

The official TypeScript library for the Cloudflare API

35 lines 1.21 kB
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from 'cloudflare/resource'; import { isRequestOptions } from 'cloudflare/core'; export class Datasets extends APIResource { list(query = {}, options) { if (isRequestOptions(query)) { return this.list({}, query); } return this._client.get('/radar/datasets', { query, ...options })._thenUnwrap((obj) => obj.result); } /** * Get a url to download a single dataset. */ download(params, options) { const { format, ...body } = params; return this._client.post('/radar/datasets/download', { query: { format }, body, ...options, })._thenUnwrap((obj) => obj.result); } get(alias, query = {}, options) { if (isRequestOptions(query)) { return this.get(alias, {}, query); } return this._client.get(`/radar/datasets/${alias}`, { query, ...options, headers: { Accept: 'text/csv', ...options?.headers }, }); } } (function (Datasets) { })(Datasets || (Datasets = {})); //# sourceMappingURL=datasets.mjs.map