(#190) - implement attachments=true for query()

Some inline notes below.


For the tests, they are largely copied from `test.attachments.js`, hence the crazy `icons` thing.