mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -9,10 +9,7 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import { linkedInApiRequest } from './GenericFunctions';
|
||||
import {
|
||||
postFields,
|
||||
postOperations,
|
||||
} from './PostDescription';
|
||||
import { postFields, postOperations } from './PostDescription';
|
||||
|
||||
export class LinkedIn implements INodeType {
|
||||
// eslint-disable-next-line n8n-nodes-base/node-class-description-missing-subtitle
|
||||
@@ -53,8 +50,6 @@ export class LinkedIn implements INodeType {
|
||||
...postOperations,
|
||||
...postFields,
|
||||
],
|
||||
|
||||
|
||||
};
|
||||
|
||||
methods = {
|
||||
@@ -64,7 +59,10 @@ export class LinkedIn implements INodeType {
|
||||
async getPersonUrn(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const person = await linkedInApiRequest.call(this, 'GET', '/me', {});
|
||||
returnData.push({ name: `${person.localizedFirstName} ${person.localizedLastName}`, value: person.id });
|
||||
returnData.push({
|
||||
name: `${person.localizedFirstName} ${person.localizedLastName}`,
|
||||
value: person.id,
|
||||
});
|
||||
return returnData;
|
||||
},
|
||||
},
|
||||
@@ -77,7 +75,7 @@ export class LinkedIn implements INodeType {
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
const operation = this.getNodeParameter('operation', 0) as string;
|
||||
|
||||
let body:any = {};// tslint:disable-line:no-any
|
||||
let body: any = {}; // tslint:disable-line:no-any
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
try {
|
||||
@@ -94,7 +92,7 @@ export class LinkedIn implements INodeType {
|
||||
if (postAs === 'person') {
|
||||
const personUrn = this.getNodeParameter('person', i) as string;
|
||||
// Only if posting as a person can user decide if post visible by public or connections
|
||||
visibility = additionalFields.visibility as string || 'PUBLIC';
|
||||
visibility = (additionalFields.visibility as string) || 'PUBLIC';
|
||||
authorUrn = `urn:li:person:${personUrn}`;
|
||||
} else {
|
||||
const organizationUrn = this.getNodeParameter('organization', i) as string;
|
||||
@@ -106,7 +104,6 @@ export class LinkedIn implements INodeType {
|
||||
let originalUrl = '';
|
||||
|
||||
if (shareMediaCategory === 'IMAGE') {
|
||||
|
||||
if (additionalFields.description) {
|
||||
description = additionalFields.description as string;
|
||||
}
|
||||
@@ -116,9 +113,7 @@ export class LinkedIn implements INodeType {
|
||||
// Send a REQUEST to prepare a register of a media image file
|
||||
const registerRequest = {
|
||||
registerUploadRequest: {
|
||||
recipes: [
|
||||
'urn:li:digitalmediaRecipe:feedshare-image',
|
||||
],
|
||||
recipes: ['urn:li:digitalmediaRecipe:feedshare-image'],
|
||||
owner: authorUrn,
|
||||
serviceRelationships: [
|
||||
{
|
||||
@@ -129,23 +124,36 @@ export class LinkedIn implements INodeType {
|
||||
},
|
||||
};
|
||||
|
||||
const registerObject = await linkedInApiRequest.call(this, 'POST', '/assets?action=registerUpload', registerRequest);
|
||||
const registerObject = await linkedInApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/assets?action=registerUpload',
|
||||
registerRequest,
|
||||
);
|
||||
|
||||
// Response provides a specific upload URL that is used to upload the binary image file
|
||||
const uploadUrl = registerObject.value.uploadMechanism['com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest'].uploadUrl as string;
|
||||
const uploadUrl = registerObject.value.uploadMechanism[
|
||||
'com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest'
|
||||
].uploadUrl as string;
|
||||
const asset = registerObject.value.asset as string;
|
||||
|
||||
// Prepare binary file upload
|
||||
const item = items[i];
|
||||
|
||||
if (item.binary === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', { itemIndex: i });
|
||||
throw new NodeOperationError(this.getNode(), 'No binary data exists on item!', {
|
||||
itemIndex: i,
|
||||
});
|
||||
}
|
||||
|
||||
const propertyNameUpload = this.getNodeParameter('binaryPropertyName', i) as string;
|
||||
|
||||
if (item.binary[propertyNameUpload] === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${propertyNameUpload}" does not exists on item!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${propertyNameUpload}" does not exists on item!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
// Buffer binary data
|
||||
@@ -180,7 +188,6 @@ export class LinkedIn implements INodeType {
|
||||
'com.linkedin.ugc.MemberNetworkVisibility': visibility,
|
||||
},
|
||||
};
|
||||
|
||||
} else if (shareMediaCategory === 'ARTICLE') {
|
||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||
|
||||
@@ -229,7 +236,6 @@ export class LinkedIn implements INodeType {
|
||||
if (title === '') {
|
||||
delete body.specificContent['com.linkedin.ugc.ShareContent'].media[0].title;
|
||||
}
|
||||
|
||||
} else {
|
||||
body = {
|
||||
author: authorUrn,
|
||||
|
||||
Reference in New Issue
Block a user