contents.js wrapper for contents service

This is PR #6671, rebased because it's a blocker for the text editor components, and @fperez asked me to make that high priority. So far, I've just rebased, I intend to test it and fix things I see.
Part of the point of the contents service is to reduce the distinction between notebooks and other types of files. There is still some distinction, but I'd prefer to keep the 1 to 1 mapping of REST actions and JS methods.