Use the cainteoir_document API.

This defines some private APIs to access internal data to aid the
transition. These will be removed when the public API is more
functional.