Christian's ozone kotlin api generator basically does this but for kotlin. It's neat, I've been using it in my app, but unfortunately, he hasn't maintained it super well, and there's been a number of spots where the code generation has just been wrong and needed manual fixes.
Edge cases like it not picking up that e.g. the preferences are an array of a type union, not a single instance of it. Or Enum/serialization names. I'm sure it's fixable on the code generation side, but lexicon parsing isn't trivial.
Part of the problem there is going from JS/TS to Kotlin, a very strongly statically-typed language that handles type unions in a funny way (sealed interfaces containing value classes) in part bc of its Java origins.