[misc] Add helper APIs

(cherry picked from commit bd97d7999d3bd7de71ef58151dbed55af445e848)