mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
18 lines
518 B
TypeScript
18 lines
518 B
TypeScript
import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
|
|
import { apiRequest } from '../transport';
|
|
|
|
export async function getFiles(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
|
const { data } = await apiRequest.call(this, 'GET', '/files', { qs: { purpose: 'assistants' } });
|
|
|
|
const returnData: INodePropertyOptions[] = [];
|
|
|
|
for (const file of data || []) {
|
|
returnData.push({
|
|
name: file.filename as string,
|
|
value: file.id as string,
|
|
});
|
|
}
|
|
|
|
return returnData;
|
|
}
|