The content API exposes attachment children through:
$contentApi->children(
$page,
Content::CONTENT_TYPE_ATTACHMENT,
);
This calls the expected Confluence REST endpoint:
GET /content/{pageId}/child/attachment
However, attachment results cannot currently be hydrated.
The response is passed through ContentSearchResult::load(), which delegates each result to AbstractContent::load(). That method only maps the page and comment content types, so attachment results throw:
HydrationException: Invalid content type: attachment
The library already defines:
Content::CONTENT_TYPE_ATTACHMENT
so this appears to be incomplete attachment support rather than an unsupported endpoint.
My proposed scope would be:
- add a ContentAttachment entity extending AbstractContent
- map Content::CONTENT_TYPE_ATTACHMENT in AbstractContent::load()
- hydrate common content fields
- hydrate stable attachment-specific fields where available, such as media type, file size and download link
- add tests covering direct attachment hydration and attachments returned through ContentSearchResult
I would keep attachment uploading, replacement and binary downloading outside the scope of the initial change.
Happy to discuss and amend as you see fit
The content API exposes attachment children through:
This calls the expected Confluence REST endpoint:
GET /content/{pageId}/child/attachment
However, attachment results cannot currently be hydrated.
The response is passed through ContentSearchResult::load(), which delegates each result to AbstractContent::load(). That method only maps the page and comment content types, so attachment results throw:
HydrationException: Invalid content type: attachment
The library already defines:
Content::CONTENT_TYPE_ATTACHMENT
so this appears to be incomplete attachment support rather than an unsupported endpoint.
My proposed scope would be:
I would keep attachment uploading, replacement and binary downloading outside the scope of the initial change.
Happy to discuss and amend as you see fit