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.
I think it's implicit that this is only for notebooks.  Since both notebooks and ordinary files are identified with paths, there is no way to enforce this in the interface.  But the server will complain if the path is not a notebook file (I assume).