This commit is contained in:
2025-12-23 14:58:14 +01:00
parent a31fa5b487
commit bdb185443c
2 changed files with 15 additions and 0 deletions

View File

@@ -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`;

View File

@@ -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');