n8n-nodes-linkupapi
Version:
n8n node for LINKUP API - Complete LinkedIn automation with 100% API coverage and full documentation
61 lines (60 loc) • 3.15 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProfileOperations = void 0;
class ProfileOperations {
static async buildRequestBody(context, itemIndex, operation) {
const body = {};
switch (operation) {
case "extractProfileInfo":
const extractProfileParams = context.getNodeParameter("extractProfileParams", itemIndex, {});
// Required parameters validation
if (!extractProfileParams.profileUrl) {
throw new Error("LinkedIn profile URL is required for this operation");
}
if (extractProfileParams.profileUrl)
body.linkedin_url = extractProfileParams.profileUrl;
if (extractProfileParams.country)
body.country = extractProfileParams.country;
break;
case "searchProfile":
const searchProfileParams = context.getNodeParameter("searchProfileParams", itemIndex, {});
if (searchProfileParams.company_url)
body.company_url = searchProfileParams.company_url;
if (searchProfileParams.location)
body.location = searchProfileParams.location;
if (searchProfileParams.school_url)
body.school_url = searchProfileParams.school_url;
if (searchProfileParams.network)
body.network = searchProfileParams.network;
if (searchProfileParams.keyword)
body.keyword = searchProfileParams.keyword;
if (searchProfileParams.total_results)
body.total_results = searchProfileParams.total_results;
if (searchProfileParams.start_page)
body.start_page = searchProfileParams.start_page;
if (searchProfileParams.end_page)
body.end_page = searchProfileParams.end_page;
if (searchProfileParams.country)
body.country = searchProfileParams.country;
if (searchProfileParams.first_name)
body.first_name = searchProfileParams.first_name;
if (searchProfileParams.last_name)
body.last_name = searchProfileParams.last_name;
if (searchProfileParams.title)
body.title = searchProfileParams.title;
if (searchProfileParams.login_token)
body.login_token = searchProfileParams.login_token;
if (searchProfileParams.fetch_invitation_state !== undefined)
body.fetch_invitation_state =
searchProfileParams.fetch_invitation_state;
break;
case "getMyProfile":
const getMyProfileParams = context.getNodeParameter("getMyProfileParams", itemIndex, {});
if (getMyProfileParams.country)
body.country = getMyProfileParams.country;
break;
}
return body;
}
}
exports.ProfileOperations = ProfileOperations;