Okay so I'm using this API https://github.com/donbalon4/API_Alfresco to upload files to Alfresco from some other PHP site of another service. I don't have any code issue, it's just that as I was using it, some doubts on how to correctly use an API came up to my mind.
I'm basically using it to create some directories into my Alfresco Share. As I said, it's working perfectly well, so the issue is not about my code but on how to use the API (or any API in general) correctly.
First off, if you take a look to that API you'll see how every method is handling exceptions, i.e. if you try to create a Folder that already exists, then an Exception will be thrown with proper information.
So far I'm just using the API to create multiple directories into some parent root, and some of those directories are likely to have the same name. So when they do, I simply don't have to create them (since directory already exists) and don't need any exception to be thrown or be shown to the end user.
What's the best approach to this goal? I don't feel like modifying the API since it would be contradicting its real meaning. If everyone modifies an existent API then it's not an API anymore. I could simply remove exception handling of methods I'm using, but I don't think it would be a great practice.
Also I realized there's a private method called existsFolder() for internal use. I could maybe change it into public so I can use it on my actual PHP code to check myself if a given folder already exists, but I don't really know if it would be a great approach either.
What would be the best way to manage directories that already exist? Replace exception handling with a text message to be shown to the end user? Or making the existsFolder() method public? Any other idea I could be missing?