WTH: Why aren't icons always included when getting states via the API?

This is probably a niche thing, but I’m building a project using the Home Assistant websocket API, and I want to show the same icon on my end that Home Assistant would show.

If I manually set an icon in Home Assistant, then the icon appears as an attribute and I can use it in my project, but if it’s not there, I need to fall back to a default. The problem is, there’s 55 domains (e.g. climate, binary_sensor, automation etc.), and in the binary_sensor domain alone, there’s 27 different device classes (e.g. door, lock, battery etc.). That’s a lot of code for me to write and maintain, just so I can show an icon to my end user.

But Home Assistant knows what icon to display, because it does so on the front end. So it’d be nice to have the icon always included as an attribute in order to retrieve the icon that is presently being shown (e.g. if my front door is open, it’d show mdi:door-open) without me having to work out what the domain is, what device class it is, what state it is, and display an icon based on that. It could even be a separate attribute for all I care (e.g. default_icon instead of icon), as long as I can retrieve it from the attributes.