How to show layout using accordion menu?

Hello All,

We are creating custom IOS application using next cloud.

We want to show all files and folder on a single screen in accordion menu.

Folder 1
   File PDF1
   File PDF2
   Folder 1.1
        Folder 1.1.1
        FILE PDF
        FILE PDF

How is it possible?

One of the solution I know that I will loop over all internal folders and create json and manage layout. Apart from that is there any other method available which can provide me whole folder structure in a single API call?