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
   FILE MP4
   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?

A photo/image would better help us understand your problem.