Adding extension for attachments

not a fan of having to "look inside" in order to sort out content-type
details. wonder if there is something we're missing. HTML doesn't have this
response issue, right?

in fact, why are we offering up a Cj collection as a multipart at all?

seems what most client would expect would be a Cj collection response with
items and maybe one of the data's link element is marked as an attachment
(render="attachment") which means you can download this element (instead of
rendering it as a "link" item or an inline image). clients that don't
understand the [render="attachment" ] directive can render the link as a
simple render="link"



On Sun, Oct 12, 2014 at 2:12 PM, Glenn Block <notifications@github.com>
wrote:

> In attachment.md:
>
> > +```
> > +## Receving attachments
> > +A client may also receive a response that contains attachments. In these cases the response media type will be "multipart/mixed" containing parts for a collection+json document as well as attachments.
> > +
> > +### Parts
> > +* The first part in the document will be a CollectionJson document. The document will contain pointers back to the attachments in the response.
> > +* All _attachment_ fields in the data element must have a value set to the name in the content-disposition header of the corresponding part.
> > +* The document part must have a "name" of "document" as it's content-disposition header
> > +* All additional parts will be attachments which relate to the document.
> > +* Each attachment must have a "name" as part of the content-disposition header.
> > +
> > +### Attachment Data field
> > +The _attachment_ field in the response indicates that this item has an associated attachment. The _value_ of the attachment matches the filename in the content-disposition header in one of the parts.
> > +
> > +### Example
> > +Below is an example of a response containing attachments. The first part is a document which contains the list of contacts where each contact has an avatar with an _attachment_ field. Then there are additional parts which are the actual attachments. Each attachment's filename corresponds to the value of the _attachment_ field for the item in  the CollectionJson document.
>
> If we go with my suggestion that I just made, the client would know if
> they get a standard CJ response that has "attachment" fields.
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/collection-json/extensions/pull/7/files#r18748997>.
>