Custom API Method to return record and all related records?

How feasible would it be to have a method developed that would return a DocType and all of its related DocTypes in a single API call?

For example, if you queried a Lead, you could get its Opportunities, Events, ToDos, etc. that are related to that lead all at once.

I’m working on a couple Microsoft Powerapps for ERPNext, and it would be very convenient to be able to get the records and their related records all in one call…

Is that even possible? If it is, I’m interested in paying to have it developed and then turned over to the community, if somebody can point me in the direction of some developers.

By related records, are you talking about records that have an explicit link to the primary document?

If so, developing an API method like that would certainly be doable. You’d probably just run a query on all docfields to identify all DocTypes having Link fields pointing at the primary DocType, then iterate through and check if any of those doctypes have a documents linking the primary document.

Something may already exist in the API, but I’m not aware of it.