Migrate api media function into client