@apify/n8n-nodes-apify
Version:
n8n nodes for Apify
25 lines • 965 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getItems = getItems;
const n8n_workflow_1 = require("n8n-workflow");
const genericFunctions_1 = require("../../../resources/genericFunctions");
async function getItems(i) {
const datasetId = this.getNodeParameter('datasetId', i);
const offset = this.getNodeParameter('offset', i, 0);
const limit = this.getNodeParameter('limit', i, 50);
if (!datasetId) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Dataset ID is required');
}
try {
const itemsArray = await genericFunctions_1.apiRequest.call(this, {
method: 'GET',
uri: `/v2/datasets/${datasetId}/items`,
qs: { offset, limit },
});
return this.helpers.returnJsonArray(itemsArray);
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=execute.js.map