nalin1729 the documentation is the source code 💩
I'm not sure I can answer all your question without spending some time in the code.
The javascript model classes source code is here https://github.com/flarum/core/tree/v0.1.0-beta.13/js/src/common/models
But those classes mostly define shortcuts to access the attributes and relationships. Which relationships are loaded depends on what is requested during a database request.
Requests follow the JSON:API https://jsonapi.org/ specification. The query and options parameters are directly applied to the REST request and follow that specification.
To find which includes and sort options are available on a REST endpoint, you need to check out the source code of the matching controller. For example when requesting GET /api/discussion/<id>, the matching controller will be https://github.com/flarum/core/blob/v0.1.0-beta.13/src/Api/Controller/ShowDiscussionController.php and on this controller 'posts', 'posts.discussion', 'posts.user', 'posts.user.groups', 'posts.editedUser', 'posts.hiddenUser' relationships are included by default, with 'user', 'lastPostedUser', 'firstPost', 'lastPost' being optionally returned.
The difficult part about documenting the API is that extensions can make many changes to it. The default and optional includes can be changed by extensions. Extensions can also register their own relationships.
All "list" REST endpoints also implement pagination. You won't be able to get "all" posts from a single request if there are more than 50 (the maximum results you can request by default)