cloudflare
Version:
The official TypeScript library for the Cloudflare API
86 lines • 2.8 kB
TypeScript
import * as Core from 'cloudflare/core';
import { APIResource } from 'cloudflare/resource';
import * as DatasetsAPI from 'cloudflare/resources/radar/datasets';
export declare class Datasets extends APIResource {
/**
* Get a list of datasets.
*/
list(query?: DatasetListParams, options?: Core.RequestOptions): Core.APIPromise<DatasetListResponse>;
list(options?: Core.RequestOptions): Core.APIPromise<DatasetListResponse>;
/**
* Get a url to download a single dataset.
*/
download(params: DatasetDownloadParams, options?: Core.RequestOptions): Core.APIPromise<DatasetDownloadResponse>;
/**
* Get the csv content of a given dataset by alias or id. When getting the content
* by alias the latest dataset is returned, optionally filtered by the latest
* available at a given date.
*/
get(alias: string, query?: DatasetGetParams, options?: Core.RequestOptions): Core.APIPromise<string>;
get(alias: string, options?: Core.RequestOptions): Core.APIPromise<string>;
}
export interface DatasetListResponse {
datasets: Array<DatasetListResponse.Dataset>;
}
export declare namespace DatasetListResponse {
interface Dataset {
id: number;
description: string;
meta: unknown;
tags: Array<string>;
title: string;
type: string;
}
}
export interface DatasetDownloadResponse {
dataset: DatasetDownloadResponse.Dataset;
}
export declare namespace DatasetDownloadResponse {
interface Dataset {
url: string;
}
}
export type DatasetGetResponse = string;
export interface DatasetListParams {
/**
* Dataset type.
*/
datasetType?: 'RANKING_BUCKET' | 'REPORT';
/**
* Format results are returned in.
*/
format?: 'JSON' | 'CSV';
/**
* Limit the number of objects in the response.
*/
limit?: number;
/**
* Number of objects to skip before grabbing results.
*/
offset?: number;
}
export interface DatasetDownloadParams {
/**
* Body param:
*/
datasetId: number;
/**
* Query param: Format results are returned in.
*/
format?: 'JSON' | 'CSV';
}
export interface DatasetGetParams {
/**
* Filter dataset alias by date
*/
date?: string | null;
}
export declare namespace Datasets {
export import DatasetListResponse = DatasetsAPI.DatasetListResponse;
export import DatasetDownloadResponse = DatasetsAPI.DatasetDownloadResponse;
export import DatasetGetResponse = DatasetsAPI.DatasetGetResponse;
export import DatasetListParams = DatasetsAPI.DatasetListParams;
export import DatasetDownloadParams = DatasetsAPI.DatasetDownloadParams;
export import DatasetGetParams = DatasetsAPI.DatasetGetParams;
}
//# sourceMappingURL=datasets.d.ts.map