n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,12 +1,6 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
// ICredentialDataDecryptedObject,
|
||||
@@ -28,8 +22,18 @@ interface IGoogleAuthCredentials {
|
||||
privateKey: string;
|
||||
}
|
||||
|
||||
export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, noCredentials = false, encoding?: null | undefined): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function googleApiRequest(
|
||||
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
resource: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
noCredentials = false,
|
||||
encoding?: null | undefined,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -54,10 +58,13 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||
if (noCredentials) {
|
||||
//@ts-ignore
|
||||
responseData = await this.helpers.request(options);
|
||||
} else{
|
||||
} else {
|
||||
const credentials = await this.getCredentials('googleApi');
|
||||
|
||||
const { access_token } = await getAccessToken.call(this, credentials as unknown as IGoogleAuthCredentials);
|
||||
const { access_token } = await getAccessToken.call(
|
||||
this,
|
||||
credentials as unknown as IGoogleAuthCredentials,
|
||||
);
|
||||
options.headers!.Authorization = `Bearer ${access_token}`;
|
||||
//@ts-ignore
|
||||
responseData = await this.helpers.request(options);
|
||||
@@ -69,16 +76,23 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
if(Object.keys(responseData as IDataObject).length !== 0) {
|
||||
if (Object.keys(responseData as IDataObject).length !== 0) {
|
||||
return responseData;
|
||||
}
|
||||
else {
|
||||
return { 'success': true };
|
||||
} else {
|
||||
return { success: true };
|
||||
}
|
||||
}
|
||||
|
||||
export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function googleApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
@@ -88,20 +102,22 @@ export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOp
|
||||
responseData = await googleApiRequest.call(this, method, endpoint, body, query);
|
||||
query.pageToken = responseData['nextPageToken'];
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
} while (
|
||||
responseData['nextPageToken'] !== undefined &&
|
||||
responseData['nextPageToken'] !== ''
|
||||
);
|
||||
} while (responseData['nextPageToken'] !== undefined && responseData['nextPageToken'] !== '');
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
export function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | ICredentialTestFunctions, credentials: IGoogleAuthCredentials): Promise<IDataObject> {
|
||||
export function getAccessToken(
|
||||
this:
|
||||
| IExecuteFunctions
|
||||
| IExecuteSingleFunctions
|
||||
| ILoadOptionsFunctions
|
||||
| ICredentialTestFunctions,
|
||||
credentials: IGoogleAuthCredentials,
|
||||
): Promise<IDataObject> {
|
||||
//https://developers.google.com/identity/protocols/oauth2/service-account#httprest
|
||||
|
||||
const scopes = [
|
||||
'https://www.googleapis.com/auth/chat.bot',
|
||||
];
|
||||
const scopes = ['https://www.googleapis.com/auth/chat.bot'];
|
||||
|
||||
const now = moment().unix();
|
||||
|
||||
@@ -110,20 +126,20 @@ export function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions
|
||||
|
||||
const signature = jwt.sign(
|
||||
{
|
||||
'iss': credentials.email as string,
|
||||
'sub': credentials.delegatedEmail || credentials.email as string,
|
||||
'scope': scopes.join(' '),
|
||||
'aud': `https://oauth2.googleapis.com/token`,
|
||||
'iat': now,
|
||||
'exp': now + 3600,
|
||||
iss: credentials.email as string,
|
||||
sub: credentials.delegatedEmail || (credentials.email as string),
|
||||
scope: scopes.join(' '),
|
||||
aud: `https://oauth2.googleapis.com/token`,
|
||||
iat: now,
|
||||
exp: now + 3600,
|
||||
},
|
||||
privateKey,
|
||||
{
|
||||
algorithm: 'RS256',
|
||||
header: {
|
||||
'kid': privateKey,
|
||||
'typ': 'JWT',
|
||||
'alg': 'RS256',
|
||||
kid: privateKey,
|
||||
typ: 'JWT',
|
||||
alg: 'RS256',
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -145,7 +161,8 @@ export function getAccessToken(this: IExecuteFunctions | IExecuteSingleFunctions
|
||||
return this.helpers.request(options);
|
||||
}
|
||||
|
||||
export function validateJSON(json: string | undefined): any { // tslint:disable-line:no-any
|
||||
// tslint:disable-next-line:no-any
|
||||
export function validateJSON(json: string | undefined): any {
|
||||
let result;
|
||||
try {
|
||||
result = JSON.parse(json!);
|
||||
@@ -156,19 +173,15 @@ export function validateJSON(json: string | undefined): any { // tslint:disable-
|
||||
}
|
||||
|
||||
export function getPagingParameters(resource: string, operation = 'getAll') {
|
||||
const pagingParameters: INodeProperties [] = [
|
||||
const pagingParameters: INodeProperties[] = [
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
resource,
|
||||
],
|
||||
operation: [
|
||||
operation,
|
||||
],
|
||||
resource: [resource],
|
||||
operation: [operation],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -183,15 +196,9 @@ export function getPagingParameters(resource: string, operation = 'getAll') {
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
resource,
|
||||
],
|
||||
operation: [
|
||||
operation,
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: [resource],
|
||||
operation: [operation],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
default: 100,
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
ICredentialsDecrypted,
|
||||
@@ -15,14 +13,9 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
IMessage,
|
||||
IMessageUi,
|
||||
} from './MessageInterface';
|
||||
import { IMessage, IMessageUi } from './MessageInterface';
|
||||
|
||||
import {
|
||||
OptionsWithUri
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
// attachmentFields,
|
||||
@@ -36,14 +29,10 @@ import {
|
||||
messageFields,
|
||||
messageOperations,
|
||||
spaceFields,
|
||||
spaceOperations
|
||||
spaceOperations,
|
||||
} from './descriptions';
|
||||
|
||||
import {
|
||||
googleApiRequest,
|
||||
googleApiRequestAllItems,
|
||||
validateJSON,
|
||||
} from './GenericFunctions';
|
||||
import { googleApiRequest, googleApiRequestAllItems, validateJSON } from './GenericFunctions';
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
@@ -124,16 +113,9 @@ export class GoogleChat implements INodeType {
|
||||
loadOptions: {
|
||||
// Get all the spaces to display them to user so that he can
|
||||
// select them easily
|
||||
async getSpaces(
|
||||
this: ILoadOptionsFunctions,
|
||||
): Promise<INodePropertyOptions[]> {
|
||||
async getSpaces(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const returnData: INodePropertyOptions[] = [];
|
||||
const spaces = await googleApiRequestAllItems.call(
|
||||
this,
|
||||
'spaces',
|
||||
'GET',
|
||||
`/v1/spaces`,
|
||||
);
|
||||
const spaces = await googleApiRequestAllItems.call(this, 'spaces', 'GET', `/v1/spaces`);
|
||||
for (const space of spaces) {
|
||||
returnData.push({
|
||||
name: space.displayName,
|
||||
@@ -144,11 +126,11 @@ export class GoogleChat implements INodeType {
|
||||
},
|
||||
},
|
||||
credentialTest: {
|
||||
async testGoogleTokenAuth(this: ICredentialTestFunctions, credential: ICredentialsDecrypted): Promise<INodeCredentialTestResult> {
|
||||
|
||||
const scopes = [
|
||||
'https://www.googleapis.com/auth/chat.bot',
|
||||
];
|
||||
async testGoogleTokenAuth(
|
||||
this: ICredentialTestFunctions,
|
||||
credential: ICredentialsDecrypted,
|
||||
): Promise<INodeCredentialTestResult> {
|
||||
const scopes = ['https://www.googleapis.com/auth/chat.bot'];
|
||||
|
||||
const now = moment().unix();
|
||||
|
||||
@@ -158,20 +140,20 @@ export class GoogleChat implements INodeType {
|
||||
try {
|
||||
const signature = jwt.sign(
|
||||
{
|
||||
'iss': email,
|
||||
'sub': credential.data!.delegatedEmail || email,
|
||||
'scope': scopes.join(' '),
|
||||
'aud': `https://oauth2.googleapis.com/token`,
|
||||
'iat': now,
|
||||
'exp': now,
|
||||
iss: email,
|
||||
sub: credential.data!.delegatedEmail || email,
|
||||
scope: scopes.join(' '),
|
||||
aud: `https://oauth2.googleapis.com/token`,
|
||||
iat: now,
|
||||
exp: now,
|
||||
},
|
||||
privateKey,
|
||||
{
|
||||
algorithm: 'RS256',
|
||||
header: {
|
||||
'kid': privateKey,
|
||||
'typ': 'JWT',
|
||||
'alg': 'RS256',
|
||||
kid: privateKey,
|
||||
typ: 'JWT',
|
||||
alg: 'RS256',
|
||||
},
|
||||
},
|
||||
);
|
||||
@@ -264,13 +246,13 @@ export class GoogleChat implements INodeType {
|
||||
|
||||
const binaryPropertyName = this.getNodeParameter('binaryPropertyName', i) as string;
|
||||
|
||||
items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(responseData, endpoint);
|
||||
|
||||
items[i].binary![binaryPropertyName] = await this.helpers.prepareBinaryData(
|
||||
responseData,
|
||||
endpoint,
|
||||
);
|
||||
}
|
||||
|
||||
} else if (resource === 'space') {
|
||||
if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// space: get
|
||||
// ----------------------------------------
|
||||
@@ -279,14 +261,8 @@ export class GoogleChat implements INodeType {
|
||||
|
||||
const spaceId = this.getNodeParameter('spaceId', i) as string;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/v1/${spaceId}`,
|
||||
);
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'GET', `/v1/${spaceId}`);
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// space: getAll
|
||||
// ----------------------------------------
|
||||
@@ -305,19 +281,12 @@ export class GoogleChat implements INodeType {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
qs.pageSize = limit;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/v1/spaces`,
|
||||
undefined,
|
||||
qs,
|
||||
);
|
||||
responseData = await googleApiRequest.call(this, 'GET', `/v1/spaces`, undefined, qs);
|
||||
responseData = responseData.spaces;
|
||||
}
|
||||
}
|
||||
} else if (resource === 'member') {
|
||||
if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// member: get
|
||||
// ----------------------------------------
|
||||
@@ -326,14 +295,8 @@ export class GoogleChat implements INodeType {
|
||||
|
||||
const memberId = this.getNodeParameter('memberId', i) as string;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/v1/${memberId}`,
|
||||
);
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'GET', `/v1/${memberId}`);
|
||||
} else if (operation === 'getAll') {
|
||||
|
||||
// ----------------------------------------
|
||||
// member: getAll
|
||||
// ----------------------------------------
|
||||
@@ -352,7 +315,6 @@ export class GoogleChat implements INodeType {
|
||||
undefined,
|
||||
qs,
|
||||
);
|
||||
|
||||
} else {
|
||||
const limit = this.getNodeParameter('limit', i) as number;
|
||||
qs.pageSize = limit;
|
||||
@@ -366,11 +328,9 @@ export class GoogleChat implements INodeType {
|
||||
);
|
||||
responseData = responseData.memberships;
|
||||
}
|
||||
|
||||
}
|
||||
} else if (resource === 'message') {
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// message: create
|
||||
// ----------------------------------------
|
||||
@@ -401,16 +361,21 @@ export class GoogleChat implements INodeType {
|
||||
if (validateJSON(messageJson as string) !== undefined) {
|
||||
message = JSON.parse(messageJson as string) as IMessage;
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), 'Message (JSON) must be a valid json', { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'Message (JSON) must be a valid json',
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
const messageUi = this.getNodeParameter('messageUi', i) as IMessageUi;
|
||||
if (messageUi.text && messageUi.text !== '') {
|
||||
message.text = messageUi.text;
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), 'Message Text must be provided.', { itemIndex: i });
|
||||
throw new NodeOperationError(this.getNode(), 'Message Text must be provided.', {
|
||||
itemIndex: i,
|
||||
});
|
||||
}
|
||||
// // TODO: get cards from the UI
|
||||
// if (messageUi?.cards?.metadataValues && messageUi?.cards?.metadataValues.length !== 0) {
|
||||
@@ -429,9 +394,7 @@ export class GoogleChat implements INodeType {
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
|
||||
// ----------------------------------------
|
||||
// message: delete
|
||||
// ----------------------------------------
|
||||
@@ -440,14 +403,8 @@ export class GoogleChat implements INodeType {
|
||||
|
||||
const messageId = this.getNodeParameter('messageId', i) as string;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'DELETE',
|
||||
`/v1/${messageId}`,
|
||||
);
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'DELETE', `/v1/${messageId}`);
|
||||
} else if (operation === 'get') {
|
||||
|
||||
// ----------------------------------------
|
||||
// message: get
|
||||
// ----------------------------------------
|
||||
@@ -456,14 +413,8 @@ export class GoogleChat implements INodeType {
|
||||
|
||||
const messageId = this.getNodeParameter('messageId', i) as string;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/v1/${messageId}`,
|
||||
);
|
||||
|
||||
responseData = await googleApiRequest.call(this, 'GET', `/v1/${messageId}`);
|
||||
} else if (operation === 'update') {
|
||||
|
||||
// ----------------------------------------
|
||||
// message: update
|
||||
// ----------------------------------------
|
||||
@@ -485,10 +436,13 @@ export class GoogleChat implements INodeType {
|
||||
if (validateJSON(updateFieldsJson as string) !== undefined) {
|
||||
message = JSON.parse(updateFieldsJson as string) as IMessage;
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), 'Update Fields (JSON) must be a valid json', { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'Update Fields (JSON) must be a valid json',
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
const updateFieldsUi = this.getNodeParameter('updateFieldsUi', i) as IDataObject;
|
||||
if (updateFieldsUi.text) {
|
||||
@@ -514,17 +468,9 @@ export class GoogleChat implements INodeType {
|
||||
updateMask = updateMask.slice(0, -1); // remove trailing comma
|
||||
qs.updateMask = updateMask;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'PUT',
|
||||
`/v1/${messageId}`,
|
||||
body,
|
||||
qs,
|
||||
);
|
||||
responseData = await googleApiRequest.call(this, 'PUT', `/v1/${messageId}`, body, qs);
|
||||
}
|
||||
|
||||
} else if (resource === 'attachment') {
|
||||
|
||||
if (operation === 'get') {
|
||||
// ----------------------------------------
|
||||
// attachment: get
|
||||
@@ -534,15 +480,10 @@ export class GoogleChat implements INodeType {
|
||||
|
||||
const attachmentName = this.getNodeParameter('attachmentName', i) as string;
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
`/v1/${attachmentName}`,
|
||||
);
|
||||
responseData = await googleApiRequest.call(this, 'GET', `/v1/${attachmentName}`);
|
||||
}
|
||||
} else if (resource === 'incomingWebhook') {
|
||||
if (operation === 'create') {
|
||||
|
||||
// ----------------------------------------
|
||||
// incomingWebhook: create
|
||||
// ----------------------------------------
|
||||
@@ -570,33 +511,29 @@ export class GoogleChat implements INodeType {
|
||||
if (validateJSON(messageJson as string) !== undefined) {
|
||||
message = JSON.parse(messageJson as string) as IMessage;
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), 'Message (JSON) must be a valid json', { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
'Message (JSON) must be a valid json',
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
const messageUi = this.getNodeParameter('messageUi', i) as IMessageUi;
|
||||
if (messageUi.text && messageUi.text !== '') {
|
||||
message.text = messageUi.text;
|
||||
} else {
|
||||
throw new NodeOperationError(this.getNode(), 'Message Text must be provided.', { itemIndex: i });
|
||||
throw new NodeOperationError(this.getNode(), 'Message Text must be provided.', {
|
||||
itemIndex: i,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const body: IDataObject = {};
|
||||
Object.assign(body, message);
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'',
|
||||
body,
|
||||
qs,
|
||||
uri,
|
||||
true,
|
||||
);
|
||||
responseData = await googleApiRequest.call(this, 'POST', '', body, qs, uri, true);
|
||||
}
|
||||
|
||||
}
|
||||
if (Array.isArray(responseData)) {
|
||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const attachmentOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,16 +8,15 @@ export const attachmentOperations: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'attachment',
|
||||
],
|
||||
resource: ['attachment'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Gets the metadata of a message attachment. The attachment data is fetched using the media API.',
|
||||
description:
|
||||
'Gets the metadata of a message attachment. The attachment data is fetched using the media API.',
|
||||
action: 'Get an attachment',
|
||||
},
|
||||
],
|
||||
@@ -27,7 +24,7 @@ export const attachmentOperations: INodeProperties[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export const attachmentFields: INodeProperties[] = [
|
||||
export const attachmentFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* attachments:get */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -38,12 +35,8 @@ export const attachmentFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'attachment',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['attachment'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const incomingWebhookOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const incomingWebhookOperations: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incomingWebhook',
|
||||
],
|
||||
resource: ['incomingWebhook'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -27,24 +23,19 @@ export const incomingWebhookOperations: INodeProperties[] = [
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export const incomingWebhookFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* incomingWebhook:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
{
|
||||
displayName: 'See <a href="https://developers.google.com/chat/how-tos/webhooks" target="_blank">Google Chat Guide</a> To Webhooks',
|
||||
displayName:
|
||||
'See <a href="https://developers.google.com/chat/how-tos/webhooks" target="_blank">Google Chat Guide</a> To Webhooks',
|
||||
name: 'jsonNotice',
|
||||
type: 'notice',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incomingWebhook',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incomingWebhook'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -56,12 +47,8 @@ export const incomingWebhookFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incomingWebhook',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incomingWebhook'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -73,12 +60,8 @@ export const incomingWebhookFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incomingWebhook',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incomingWebhook'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -92,18 +75,12 @@ export const incomingWebhookFields: INodeProperties[] = [
|
||||
placeholder: 'Add Options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incomingWebhook',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
false,
|
||||
],
|
||||
resource: ['incomingWebhook'],
|
||||
operation: ['create'],
|
||||
jsonParameters: [false],
|
||||
},
|
||||
},
|
||||
default: {'text': ''},
|
||||
default: { text: '' },
|
||||
description: 'The message object',
|
||||
options: [
|
||||
{
|
||||
@@ -116,20 +93,15 @@ export const incomingWebhookFields: INodeProperties[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'See <a href="https://developers.google.com/chat/reference/rest/v1/spaces.messages#Message" target="_blank">Google Chat Guide</a> To Creating Messages',
|
||||
displayName:
|
||||
'See <a href="https://developers.google.com/chat/reference/rest/v1/spaces.messages#Message" target="_blank">Google Chat Guide</a> To Creating Messages',
|
||||
name: 'jsonNotice',
|
||||
type: 'notice',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incomingWebhook',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
true,
|
||||
],
|
||||
resource: ['incomingWebhook'],
|
||||
operation: ['create'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -144,15 +116,9 @@ export const incomingWebhookFields: INodeProperties[] = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incomingWebhook',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
true,
|
||||
],
|
||||
resource: ['incomingWebhook'],
|
||||
operation: ['create'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -166,12 +132,8 @@ export const incomingWebhookFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'incomingWebhook',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['incomingWebhook'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -180,7 +142,8 @@ export const incomingWebhookFields: INodeProperties[] = [
|
||||
name: 'threadKey',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'Thread identifier which groups messages into a single thread. Has no effect if thread field, corresponding to an existing thread, is set in message. Example: spaces/AAAAMpdlehY/threads/MZ8fXhZXGkk.',
|
||||
description:
|
||||
'Thread identifier which groups messages into a single thread. Has no effect if thread field, corresponding to an existing thread, is set in message. Example: spaces/AAAAMpdlehY/threads/MZ8fXhZXGkk.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const mediaOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const mediaOperations: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'media',
|
||||
],
|
||||
resource: ['media'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -27,7 +23,7 @@ export const mediaOperations: INodeProperties[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export const mediaFields: INodeProperties[] = [
|
||||
export const mediaFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* media:download */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -38,12 +34,8 @@ export const mediaFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'media',
|
||||
],
|
||||
operation: [
|
||||
'download',
|
||||
],
|
||||
resource: ['media'],
|
||||
operation: ['download'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -57,12 +49,8 @@ export const mediaFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'media',
|
||||
],
|
||||
operation: [
|
||||
'download',
|
||||
],
|
||||
resource: ['media'],
|
||||
operation: ['download'],
|
||||
},
|
||||
},
|
||||
description: 'Name of the binary property to which to write the data of the read file',
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
getPagingParameters
|
||||
} from '../GenericFunctions';
|
||||
import { getPagingParameters } from '../GenericFunctions';
|
||||
|
||||
export const memberOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -14,9 +10,7 @@ export const memberOperations: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'member',
|
||||
],
|
||||
resource: ['member'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -37,7 +31,6 @@ export const memberOperations: INodeProperties[] = [
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
export const memberFields: INodeProperties[] = [
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* member:get */
|
||||
@@ -49,12 +42,8 @@ export const memberFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'member',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['member'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -74,18 +63,14 @@ export const memberFields: INodeProperties[] = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'member',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['member'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: [],
|
||||
description: 'The name of the space for which to retrieve members, in the form "spaces/*". Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The name of the space for which to retrieve members, in the form "spaces/*". Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
|
||||
...getPagingParameters('member'),
|
||||
];
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const messageOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const messageOperations: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
resource: ['message'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -46,7 +42,6 @@ export const messageOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const messageFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* message:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -60,16 +55,13 @@ export const messageFields: INodeProperties[] = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'Space resource name, in the form "spaces/*". Example: spaces/AAAAMpdlehY. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'JSON Parameters',
|
||||
@@ -77,12 +69,8 @@ export const messageFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -96,15 +84,9 @@ export const messageFields: INodeProperties[] = [
|
||||
placeholder: 'Add Message',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
false,
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
jsonParameters: [false],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -165,20 +147,15 @@ export const messageFields: INodeProperties[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'See <a href="https://developers.google.com/chat/reference/rest/v1/spaces.messages#Message" target="_blank">Google Chat Guide</a> To Creating Messages',
|
||||
displayName:
|
||||
'See <a href="https://developers.google.com/chat/reference/rest/v1/spaces.messages#Message" target="_blank">Google Chat Guide</a> To Creating Messages',
|
||||
name: 'jsonNotice',
|
||||
type: 'notice',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
true,
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -193,15 +170,9 @@ export const messageFields: INodeProperties[] = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
jsonParameters: [
|
||||
true,
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -215,12 +186,8 @@ export const messageFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -236,7 +203,8 @@ export const messageFields: INodeProperties[] = [
|
||||
name: 'requestId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'A unique request ID for this message. If a message has already been created in the space with this request ID, the subsequent request will return the existing message and no new message will be created.',
|
||||
description:
|
||||
'A unique request ID for this message. If a message has already been created in the space with this request ID, the subsequent request will return the existing message and no new message will be created.',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -251,12 +219,8 @@ export const messageFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -273,12 +237,8 @@ export const messageFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -295,12 +255,8 @@ export const messageFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -312,12 +268,8 @@ export const messageFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -331,15 +283,9 @@ export const messageFields: INodeProperties[] = [
|
||||
placeholder: 'Add Options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
jsonParameters: [
|
||||
false,
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['update'],
|
||||
jsonParameters: [false],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -400,20 +346,15 @@ export const messageFields: INodeProperties[] = [
|
||||
],
|
||||
},
|
||||
{
|
||||
displayName: 'See <a href="https://developers.google.com/chat/reference/rest/v1/spaces.messages#Message" target="_blank">Google Chat Guide</a> To Creating Messages',
|
||||
displayName:
|
||||
'See <a href="https://developers.google.com/chat/reference/rest/v1/spaces.messages#Message" target="_blank">Google Chat Guide</a> To Creating Messages',
|
||||
name: 'jsonNotice',
|
||||
type: 'notice',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
jsonParameters: [
|
||||
true,
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['update'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
@@ -428,15 +369,9 @@ export const messageFields: INodeProperties[] = [
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
jsonParameters: [
|
||||
true,
|
||||
],
|
||||
resource: ['message'],
|
||||
operation: ['update'],
|
||||
jsonParameters: [true],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
getPagingParameters
|
||||
} from '../GenericFunctions';
|
||||
import { getPagingParameters } from '../GenericFunctions';
|
||||
|
||||
export const spaceOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -14,9 +10,7 @@ export const spaceOperations: INodeProperties[] = [
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'space',
|
||||
],
|
||||
resource: ['space'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -48,12 +42,8 @@ export const spaceFields: INodeProperties[] = [
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'space',
|
||||
],
|
||||
operation: [
|
||||
'get',
|
||||
],
|
||||
resource: ['space'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
|
||||
Reference in New Issue
Block a user