cloudflare
Version:
The official TypeScript library for the Cloudflare API
62 lines • 2.62 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Available = exports.BaseAvailable = void 0;
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
const resource_1 = require("../../../../core/resource.js");
const error_1 = require("../../../../core/error.js");
const pagination_1 = require("../../../../core/pagination.js");
const path_1 = require("../../../../internal/utils/path.js");
var BaseAvailable = /* @__PURE__ */ (() => {
class BaseAvailable extends resource_1.APIResource {
/**
* Returns all dataset types that this account or zone can create. Each entry
* includes the dataset schema and timestamp field.
*
* The schema shows all possible fields for a dataset. However, not all fields may
* be available for your account or zone. When creating or updating a dataset, only
* fields available to your account or zone can be enabled. If you request a field
* that is not available, you will receive an error.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const availableDataset of client.logs.logExplorer.datasets.available.list(
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
list(params = {}, options) {
const { account_id, zone_id } = params ?? {};
if (!account_id && !zone_id) {
throw new error_1.CloudflareError('You must provide either account_id or zone_id.');
}
if (account_id && zone_id) {
throw new error_1.CloudflareError('You cannot provide both account_id and zone_id.');
}
const { accountOrZone, accountOrZoneId } = account_id ?
{
accountOrZone: 'accounts',
accountOrZoneId: account_id,
}
: {
accountOrZone: 'zones',
accountOrZoneId: zone_id,
};
return this._client.getAPIList((0, path_1.path) `/${accountOrZone}/${accountOrZoneId}/logs/explorer/datasets/available`, (pagination_1.SinglePage), options);
}
}
BaseAvailable._key = Object.freeze([
'logs',
'logExplorer',
'datasets',
'available',
]);
return BaseAvailable;
})();
exports.BaseAvailable = BaseAvailable;
class Available extends BaseAvailable {
}
exports.Available = Available;
//# sourceMappingURL=available.js.map