Document annotations API in SDK reference docs#3368
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR expands the documentation coverage for the message annotations API, adding end-user guidance for retrieving annotations and filling in previously missing SDK reference surface area and related types.
Changes:
- Adds a Retrieve annotations section to the message annotations guide, including multi-language examples and guidance on when to prefer
channel.getMessage(). - Documents
Channel.annotationsand the full REST/Realtime annotations API surfaces (publish/delete/get/subscribe/unsubscribe) in the SDK reference channel pages. - Adds and expands missing related types in the realtime SDK types reference, including
Annotation,AnnotationAction, query params/types, and summary entry types.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/pages/docs/messages/annotations.mdx | Adds end-user “Retrieve annotations” guidance and promotes annotation properties to a top-level section. |
| src/pages/docs/api/rest-sdk/channels.mdx | Documents Channel.annotations and introduces RestAnnotations reference section and methods. |
| src/pages/docs/api/realtime-sdk/channels.mdx | Documents Channel.annotations and introduces RealtimeAnnotations reference section and methods (incl. subscribe/unsubscribe). |
| src/pages/docs/api/realtime-sdk/types.mdx | Adds annotation-related types and fleshes out MessageAnnotations.summary typing and summary entry structures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@claude review |
| <Aside data-type='note'> | ||
| You should only use this method if you need the full list of individual, raw annotations. If you only need the latest [annotation summary](#annotation-summaries) for a message — for example on a channel you are not subscribed to, where you are not receiving `message.summary` updates — use [`channel.getMessage()`](/docs/messages/updates-deletes#get) instead. The returned message contains the up-to-date `annotations.summary`. |
There was a problem hiding this comment.
Deployed current branch preview at https://ably-docs-annotations-g-nzmo0d.herokuapp.com/docs/messages/annotations with username/password =
preview.
This seems like a really short note to retrieve annotation summary for given message/message-serial.
As a third person going through the docs, I understand following
Annotations as a feature is defined by the summary =>
- The five aggregation methods (total.v1, flag.v1, distinct.v1, unique.v1, multiple.v1) all exist to produce different shapes of summary.
- Since,
summaryis a user-facing output, we should explicitly mention ways to retrieve it. - IMHO, a dedicated section to retrieve
individual annotationsusing channel.annotations.get with examples provides a very limited use-case value. Also, same events can already be consumed in real time via annotations.subscribe.
Keeping channel.annotations.get section is fine, but a section focused on retrieving summaries under channel.subscribe with relevant examples would provide significantly more value to readers/LLMs.
So, a new Retrieve annotation summary section can be added with examples using channel.getMessage and channel.history -> Internal slack link - ways to retrieve summary
There was a problem hiding this comment.
a section focused on retrieving summaries under channel.subscribe with relevant examples would provide significantly more value
This already exists, it's the section entitled "Subscribe to annotation summaries".
There was a problem hiding this comment.
Above mentioned link Internal slack link - ways to retrieve summary, Currently, 3 ways to show summaries
1. Live: subscribe to the channel message listener; the server pushes `MESSAGE_SUMMARY` actions.
2. Per-message latest: `channel.getMessage(serial).annotations.summary`.
3. Bulk historical: `channel.history()`; each `Message` already carries `annotations.summary`.
We missing section for 2nd and 3rd one, they are specific to Retrieve annotation summary rather than Subscribe to annotation summaries.
There was a problem hiding this comment.
I don't agree that annotations.summary being a field on a message means that the annotation docs should have individual sections documenting every api we have that is capable of retrieving messages . Those apis have their own docs pages: once a user knows that the annotation summary is part of the message, they can use that knowledge together with other parts of our documentation; the annotations page need not stand in isolation.
But I am happy to add a short paragraph mentioning those two apis to document that both they will indeed give you the latest version of the summary.
Adds a new "Retrieve annotations" section covering channel.annotations.get() with samples for JS, Node, Java, Swift, and Python, plus a note pointing users to channel.getMessage() when they only need the latest summary. Also promotes the "Annotation message properties" subheading to a top-level heading. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the annotations API surface to the realtime and rest SDK reference pages, which previously documented only the Message annotations property and a minimal MessageAnnotations entry. - Adds `RealtimeAnnotations` (publish/delete/get/subscribe/unsubscribe) and `RestAnnotations` (publish/delete/get) sections to the channels pages, plus a Channel.annotations property pointing to them. - Adds Annotation, OutboundAnnotation (JS/Cocoa), AnnotationAction, GetAnnotationsParams (JS), ARTAnnotationsQuery (Cocoa), and the per-language summary entry types (SummaryClientIdList, SummaryClientIdCounts, SummaryTotal, plus the Java `Summary` wrapper) to realtime-sdk/types.mdx. - Updates the MessageAnnotations.summary row to describe the typed structure per language rather than leaving it as JsonObject. - Restricts new content to languages that actually ship the API: JS, Node, Java, Swift, Objective-C, Python. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Drop the #summary-entry intra-page link for languages where the Summary entry types section is not rendered (csharp, go, flutter, ruby, php), so the row prose still works without a broken anchor. - Clarify which Annotation fields are user-settable when publishing vs server- or SDK-populated, rather than calling all non-(type, name, count, data) fields "server-set" — extras and encoding are user-settable, and action / messageSerial are SDK-set on publish. - Switch the messages/annotations.mdx paginated-result link from rest-sdk/types to realtime-sdk/types, matching the wider docs convention for cross-product guide pages (14 vs 6 references). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2d5d5a0 to
9236f1a
Compare
Summary
Test plan
🤖 Generated with Claude Code