That is understandable. There is similar code though. It’s here: discourse/app/models/post.rb at main · discourse/discourse · GitHub. The structure of the DIscourse database is very consistent. Hopefully this helps to make up for the lack of documentation.
I’m not sure that every field returned by the API will get documented, but documenting the various places where number codes are returned seems important. Example of this are:
Post.types
UserAction.types
Notification.types
NotificationLevels.all
UserOption.email_level_types
If we go ahead with this, I’m not sure what the best place would be for the documentation. Possibly at https://docs.discourse.org/, but it’s possible there will be technical issues with doing that.