Reuse Files functionality

I have this app that has a custom search provider, it returns a list of files IDs. I want to show the list on the front end, but the list would end-up being exactly the same as the integrated “Files” app.
Can I just reuse the Files functionality?
I was thinking something like this:

var fileList = MyApp.getfiles(param1, param2);
var nc_files = new Files(); // Nextcloud Files
nc_files.render(); // here the Files would render itself with only the files from fileList

Another option would be to redirect users to Files app but passing the IDs in the URL.

var fileList = MyApp.getfiles(param1, param2);
var redirURI = uri(path("/apps/files"));
redirURI.addQuery("q", "filterfiles");
redirURI.addQuery("IDs", fileList);

The code above would then open the browser at,8729
And the Files app would show the list, but only with the files in IDs list.

I would be happy with either solutions, render directly from Files or open a new browser tab with Files filtered.

Any ideas?


Are the file nodes guaranteed to reside in the same folder?

A quick glance at the Files app does not reveal such a feature to filter files. Depending on your use case, this might be possible to handle in the backend using a custom storage.