@apify/n8n-nodes-apify
Version:
n8n nodes for Apify
24 lines • 894 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getLastRun = getLastRun;
const n8n_workflow_1 = require("n8n-workflow");
const genericFunctions_1 = require("../../../resources/genericFunctions");
async function getLastRun(i) {
const actorId = this.getNodeParameter('userActorId', i);
const status = this.getNodeParameter('status', i);
if (!actorId) {
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Actor ID is required');
}
try {
const apiResult = await genericFunctions_1.apiRequest.call(this, {
method: 'GET',
uri: `/v2/acts/${actorId.value}/runs/last`,
qs: { status },
});
return { json: { ...apiResult.data } };
}
catch (error) {
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
}
}
//# sourceMappingURL=execute.js.map