You can't download files in shared folders using public links because public links can't be obtained from shared files. You need to download them directly.
I don't think that printing on stdout is the right thing to do in this api layer. It should be handled by the calling layer shounldn't it ? Was that debug code ?