Files
Automata/packages/nodes-base/nodes/Google/Drive/v2/actions/drive/get.operation.ts
Iván Ovejero 62c096710f refactor: Run lintfix (no-changelog) (#7537)
- Fix autofixable violations
- Remove unused directives
- Allow for PascalCased variables - needed for dynamically imported or
assigned classes, decorators, routers, etc.
2023-10-27 14:15:02 +02:00

68 lines
1.7 KiB
TypeScript

import type {
IExecuteFunctions,
IDataObject,
INodeExecutionData,
INodeProperties,
} from 'n8n-workflow';
import { googleApiRequest } from '../../transport';
import { sharedDriveRLC } from '../common.descriptions';
import { updateDisplayOptions } from '@utils/utilities';
const properties: INodeProperties[] = [
{
...sharedDriveRLC,
description: 'The shared drive to get',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
options: [
{
displayName: 'Use Domain Admin Access',
name: 'useDomainAdminAccess',
type: 'boolean',
default: false,
description:
'Whether to issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the shared drive belongs',
},
],
},
];
const displayOptions = {
show: {
resource: ['drive'],
operation: ['get'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number): Promise<INodeExecutionData[]> {
const returnData: INodeExecutionData[] = [];
const options = this.getNodeParameter('options', i);
const driveId = this.getNodeParameter('driveId', i, undefined, {
extractValue: true,
}) as string;
const qs: IDataObject = {};
Object.assign(qs, options);
const response = await googleApiRequest.call(this, 'GET', `/drive/v3/drives/${driveId}`, {}, qs);
const executionData = this.helpers.constructExecutionMetaData(
this.helpers.returnJsonArray(response as IDataObject[]),
{ itemData: { item: i } },
);
returnData.push(...executionData);
return returnData;
}