n8n-nodes-instantly-dev
Version:
n8n community node for Instantly API v2 - DEV TESTING VERSION
49 lines • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.instantlyApiRequest = instantlyApiRequest;
exports.instantlyApiRequestAllItems = instantlyApiRequestAllItems;
/**
* Make an API request to Instantly
*/
async function instantlyApiRequest(method, endpoint, body = {}, qs = {}) {
const options = {
method,
url: `https://api.instantly.ai${endpoint}`,
headers: {
'Accept': 'application/json',
},
qs: {
...qs,
},
body,
json: true,
};
// Only set Content-Type and include body for requests that have data
if (Object.keys(body).length > 0) {
options.headers['Content-Type'] = 'application/json';
}
else {
// Remove body for requests without data (like DELETE)
delete options.body;
}
try {
return await this.helpers.httpRequestWithAuthentication.call(this, 'instantlyApi', options);
}
catch (error) {
const err = error;
if (err.response && err.response.body && err.response.body.message) {
throw new Error(`Instantly error response [${err.response.statusCode}]: ${err.response.body.message}`);
}
throw error;
}
}
/**
* Make an API request to Instantly and return all results using cursor-based pagination
* This function is deprecated - use custom pagination logic in the node implementation instead
*/
async function instantlyApiRequestAllItems(method, endpoint, body = {}, qs = {}) {
// This function is deprecated and should not be used
// Use the custom pagination logic in the node implementation instead
throw new Error('instantlyApiRequestAllItems is deprecated. Use custom pagination logic in the node implementation.');
}
//# sourceMappingURL=generic.functions.js.map