Support ordering API thread/message results by subject or date.

Addresses T57.