n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject, NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string,
|
||||
endpoint: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
export async function googleApiRequest(
|
||||
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
let options: OptionsWithUri = {
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method,
|
||||
@@ -33,8 +34,11 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||
delete options.body;
|
||||
}
|
||||
//@ts-ignore
|
||||
return await this.helpers.requestOAuth2.call(this, 'googleCloudNaturalLanguageOAuth2Api', options);
|
||||
|
||||
return await this.helpers.requestOAuth2.call(
|
||||
this,
|
||||
'googleCloudNaturalLanguageOAuth2Api',
|
||||
options,
|
||||
);
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IDataObject, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
import { IData } from './Interface';
|
||||
|
||||
import {
|
||||
IData,
|
||||
} from './Interface';
|
||||
|
||||
import {
|
||||
googleApiRequest,
|
||||
} from './GenericFunctions';
|
||||
import { googleApiRequest } from './GenericFunctions';
|
||||
|
||||
export class GoogleCloudNaturalLanguage implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
@@ -60,9 +48,7 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'document',
|
||||
],
|
||||
resource: ['document'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -92,13 +78,12 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
||||
},
|
||||
],
|
||||
default: 'content',
|
||||
description: 'The source of the document: a string containing the content or a Google Cloud Storage URI',
|
||||
description:
|
||||
'The source of the document: a string containing the content or a Google Cloud Storage URI',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'analyzeSentiment',
|
||||
],
|
||||
operation: ['analyzeSentiment'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -107,16 +92,13 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
||||
name: 'content',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The content of the input in string format. Cloud audit logging exempt since it is based on user data.',
|
||||
description:
|
||||
'The content of the input in string format. Cloud audit logging exempt since it is based on user data.',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'analyzeSentiment',
|
||||
],
|
||||
source: [
|
||||
'content',
|
||||
],
|
||||
operation: ['analyzeSentiment'],
|
||||
source: ['content'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -125,16 +107,13 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
||||
name: 'gcsContentUri',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The Google Cloud Storage URI where the file content is located. This URI must be of the form: <code>gs://bucket_name/object_name</code>. For more details, see <a href="https://cloud.google.com/storage/docs/reference-uris.">reference</a>.',
|
||||
description:
|
||||
'The Google Cloud Storage URI where the file content is located. This URI must be of the form: <code>gs://bucket_name/object_name</code>. For more details, see <a href="https://cloud.google.com/storage/docs/reference-uris.">reference</a>.',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'analyzeSentiment',
|
||||
],
|
||||
source: [
|
||||
'gcsContentUri',
|
||||
],
|
||||
operation: ['analyzeSentiment'],
|
||||
source: ['gcsContentUri'],
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -144,9 +123,7 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'analyzeSentiment',
|
||||
],
|
||||
operation: ['analyzeSentiment'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -266,7 +243,8 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
||||
],
|
||||
default: 'en',
|
||||
placeholder: '',
|
||||
description: 'The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted.',
|
||||
description:
|
||||
'The language of the document (if not specified, the language is automatically detected). Both ISO and BCP-47 language codes are accepted.',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -306,7 +284,12 @@ export class GoogleCloudNaturalLanguage implements INodeType {
|
||||
body.document.language = options.language as string;
|
||||
}
|
||||
|
||||
const response = await googleApiRequest.call(this, 'POST', `/v1/documents:analyzeSentiment`, body);
|
||||
const response = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
`/v1/documents:analyzeSentiment`,
|
||||
body,
|
||||
);
|
||||
responseData.push(response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,4 +8,4 @@ export interface IDocument {
|
||||
language?: string;
|
||||
content?: string;
|
||||
gcsContentUri?: string;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user