Get Historical SP and Query Statistics

I want to retrieve the slow queries and Stored procedures from the Idera database(without using the UI Application --- i want to do it programmatically)

which tables or SP I should query in the IDera DB so that I can get these details for the last week's data