Migrate samples to the new API.
Merge pull request #698 from square/jw/towards-the-new-api

Migrate samples to the new API.