mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
42 lines
1.1 KiB
TypeScript
42 lines
1.1 KiB
TypeScript
import type { IExecuteFunctions } from 'n8n-core';
|
|
import type { INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
|
|
import { updateDisplayOptions } from '../../../../../../utils/utilities';
|
|
import { googleApiRequest } from '../../transport';
|
|
import { sharedDriveRLC } from '../common.descriptions';
|
|
|
|
const properties: INodeProperties[] = [
|
|
{
|
|
...sharedDriveRLC,
|
|
description: 'The shared drive to delete',
|
|
},
|
|
];
|
|
|
|
const displayOptions = {
|
|
show: {
|
|
resource: ['drive'],
|
|
operation: ['deleteDrive'],
|
|
},
|
|
};
|
|
|
|
export const description = updateDisplayOptions(displayOptions, properties);
|
|
|
|
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
|
|
const returnData: INodeExecutionData[] = [];
|
|
|
|
const driveId = this.getNodeParameter('driveId', i, undefined, {
|
|
extractValue: true,
|
|
}) as string;
|
|
|
|
await googleApiRequest.call(this, 'DELETE', `/drive/v3/drives/${driveId}`);
|
|
|
|
const executionData = this.helpers.constructExecutionMetaData(
|
|
this.helpers.returnJsonArray({ success: true }),
|
|
{ itemData: { item: i } },
|
|
);
|
|
|
|
returnData.push(...executionData);
|
|
|
|
return returnData;
|
|
}
|