New user rest APIs

This method is not entirely accurate.  For example, a user may not be able to see the course because it is hidden or the category is hidden.  I recommend that you use $this->helper->connector->get_courses(...) (That goes to the block_intelligent_learning_helper_connector class).  Or you can just use enrol_get_users_courses(...) directly.

You can then just skip courses that do not meet your date restriction.