mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(LinkedIn Node): Add support for Community Management API (#7451)
This commit is contained in:
@@ -25,6 +25,14 @@ export async function linkedInApiRequest(
|
||||
binary?: boolean,
|
||||
_headers?: object,
|
||||
): Promise<any> {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
const credentialType =
|
||||
authenticationMethod === 'standard'
|
||||
? 'linkedInOAuth2Api'
|
||||
: 'linkedInCommunityManagementOAuth2Api';
|
||||
|
||||
const baseUrl = 'https://api.linkedin.com';
|
||||
|
||||
let options: OptionsWithUrl = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -33,9 +41,10 @@ export async function linkedInApiRequest(
|
||||
},
|
||||
method,
|
||||
body,
|
||||
url: binary ? endpoint : `https://api.linkedin.com/rest${endpoint}`,
|
||||
url: binary ? endpoint : `${baseUrl}${endpoint.includes('v2') ? '' : '/rest'}${endpoint}`,
|
||||
json: true,
|
||||
};
|
||||
|
||||
options = Object.assign({}, options, {
|
||||
resolveWithFullResponse: true,
|
||||
});
|
||||
@@ -51,7 +60,7 @@ export async function linkedInApiRequest(
|
||||
|
||||
try {
|
||||
return resolveHeaderData(
|
||||
await this.helpers.requestOAuth2.call(this, 'linkedInOAuth2Api', options, {
|
||||
await this.helpers.requestOAuth2.call(this, credentialType, options, {
|
||||
tokenType: 'Bearer',
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user