I really was questioning to myself where to ask this, as I could not decide myself. This is more of a software design question.
Context
I currently maintain a small Node.js module on NPM which basically acts as an API wrapper for an online service.
Issue
I have one function in the module which, when called with a string, makes one request to the service and receives the data, from a page, relevant to that one string input.
However, as a programmer and user of the service, I can understand that it might be useful to get the data for all possible input strings on that page. The way I have the module now, a programmer using my API wrapper would need to know every string, and call it every time, making a total of n requests, 1 for each string input, which is unacceptable if I'm trying to write a nice API wrapper for other developers (which I am).
* Possible Solutions/Question *
I thought to myself, I could write the function so that depending on the input string, if it's a special value (like null), I could retrieve all relevant data, but then I questioned whether this is good practice.
If I document the special input case nicely, is it good practice to have a specific parameter to a function which always produces a specific output? Is it better just to write another function that performs this procedure? I feel like having another function would violate the DRY principle because most of the code would be the same in the new function.
Thanks everyone! This really has bugged me for quite a while now.