n8n-nodes-base
Version:
Base nodes of n8n
81 lines • 2.85 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.description = void 0;
exports.execute = execute;
const utilities_1 = require("../../../../../../utils/utilities");
const transport_1 = require("../../transport");
const properties = [
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
default: false,
description: 'Whether to return all results or only up to a given limit',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
returnAll: [false],
},
},
typeOptions: {
minValue: 1,
maxValue: 200,
},
default: 100,
description: 'Max number of results to return',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add option',
default: {},
options: [
{
displayName: 'Query',
name: 'q',
type: 'string',
default: '',
description: 'Query string for searching shared drives. See the <a href="https://developers.google.com/drive/api/v3/search-shareddrives">"Search for shared drives"</a> guide for supported syntax.',
},
{
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: ['list'],
},
};
exports.description = (0, utilities_1.updateDisplayOptions)(displayOptions, properties);
async function execute(i) {
const returnData = [];
const options = this.getNodeParameter('options', i);
const returnAll = this.getNodeParameter('returnAll', i);
const qs = {};
let response = [];
Object.assign(qs, options);
if (returnAll) {
response = await transport_1.googleApiRequestAllItems.call(this, 'GET', 'drives', '/drive/v3/drives', {}, qs);
}
else {
qs.pageSize = this.getNodeParameter('limit', i);
const data = await transport_1.googleApiRequest.call(this, 'GET', '/drive/v3/drives', {}, qs);
response = data.drives;
}
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(response), { itemData: { item: i } });
returnData.push(...executionData);
return returnData;
}
//# sourceMappingURL=list.operation.js.map