What is the class object in Trino API which stores the query result?

In Trino, as per the oreilly-trino-guide, the coordinator talks to workers to assign work, update status, and fetch the top-level result set to return to the users.

I want to know the class object which stores the query responses(accumulated) before the same is sent to the client user. Further, any reference to the Trino APIs documentation would be helpful.

The result set is not stored in one object … it is streamed back to the requesting client over a longer, complex API interaction. Generally it is best to just use a supported client like the CLI, the JDBC driver, the python client and others and applications that use these.

Here is a list of available clients for different use cases - Trino | Clients

If you really cant work with them and need to implement the REST API … look at Trino client REST API — Trino 422 Documentation