Query Count of Specific Event Action

I need to make a widget/plugin for my organization using Piwik but I’m a little lost. We send custom events to Piwik such as:

Category: Staff
Action: Login

How would i query piwik from within a widget/plugin to get the # of events that match that particular category/action?

Thanks in advance!