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.