cloudflare
Version:
The official TypeScript library for the Cloudflare API
56 lines • 2.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Jobs = exports.BaseJobs = 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 BaseJobs = /* @__PURE__ */ (() => {
class BaseJobs extends resource_1.APIResource {
/**
* Lists Logpush jobs for an account or zone for a dataset.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const logpushJob of client.logpush.datasets.jobs.get(
* 'gateway_dns',
* { account_id: 'account_id' },
* )) {
* // ...
* }
* ```
*/
get(datasetID, 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}/logpush/datasets/${datasetID}/jobs`, (pagination_1.SinglePage), options);
}
}
BaseJobs._key = Object.freeze([
'logpush',
'datasets',
'jobs',
]);
return BaseJobs;
})();
exports.BaseJobs = BaseJobs;
class Jobs extends BaseJobs {
}
exports.Jobs = Jobs;
//# sourceMappingURL=jobs.js.map