listfile
This commit is contained in:
@@ -89,6 +89,11 @@ export class KDrive implements INodeType {
|
||||
value: 'listFiles',
|
||||
description: 'List files in a directory',
|
||||
},
|
||||
{
|
||||
name: 'List Files by Path',
|
||||
value: 'listFilesByPath',
|
||||
description: 'List files in a directory using path',
|
||||
},
|
||||
{
|
||||
name: 'Get File Info',
|
||||
value: 'getFileInfo',
|
||||
@@ -400,6 +405,15 @@ export class KDrive implements INodeType {
|
||||
parentDirectoryId = 'root';
|
||||
}
|
||||
|
||||
const endpoint = parentDirectoryId === 'root'
|
||||
? `/3/drive/${driveId}/files/1/files`
|
||||
: `/3/drive/${driveId}/files/${parentDirectoryId}/files`;
|
||||
const response = await kdriveApiRequest.call(this, 'GET', endpoint, {}, credentials);
|
||||
returnData.push({ json: response });
|
||||
} else if (operation === 'listFilesByPath') {
|
||||
const directoryPath = this.getNodeParameter('directoryPath', i) as string;
|
||||
const parentDirectoryId = await resolvePathToId.call(this, directoryPath, driveId, credentials);
|
||||
|
||||
const endpoint = parentDirectoryId === 'root'
|
||||
? `/3/drive/${driveId}/files/1/files`
|
||||
: `/3/drive/${driveId}/files/${parentDirectoryId}/files`;
|
||||
|
||||
@@ -63,6 +63,7 @@ describe('KDrive Node', () => {
|
||||
expect(operationProperty).toBeDefined();
|
||||
if (operationProperty && operationProperty.options) {
|
||||
const operationValues = operationProperty.options.map((opt: any) => opt.value);
|
||||
expect(operationValues).toContain('listFilesByPath');
|
||||
expect(operationValues).toContain('getFileInfoByPath');
|
||||
expect(operationValues).toContain('uploadFileByPath');
|
||||
expect(operationValues).toContain('downloadFileByPath');
|
||||
|
||||
Reference in New Issue
Block a user