Custom Dimension Event Action

Hi, I would like to query the Reporting API to get a pivot table of event names with a custom dimension, like so:

Event A Event B Event C
Cus. Dim. Val. 1 19 25 32
Cus. Dim. Val. 2 80 76 42
Cus. Dim. Val. 3 42 20 42

I am not sure what method to use. At the moment, I am using Live.getLastVisitsDetails to get all visits and all events associated with all visits then manually constructing the pivot table, but this seems super inefficient. What method should I use?