Skip to content

[EDU-1590] Update JS API references to match latest ably-js v2 API #2648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

VeskeR
Copy link
Contributor

@VeskeR VeskeR commented Jun 5, 2025

Description

Based on the work done by @m-hulbert in 521c24f, this PR adds final changes in de8f17d to update all JS API docs to match latest ably-js v2.

Note:

  • This PR does not add the annotations API: Message.summary, Annotation message, RestAnnotations and RealtimeAnnotations are not included in this PR. Should be added once Feature/pub 1676 message annotations #2642 is completed and merged.
  • This PR does not update the LiveObjects API references at https://ably.com/docs/liveobjects. For now it will still point to the TypeDoc, until API is no longer experimental

Resolves EDU-1590

Checklist

Copy link

coderabbitai bot commented Jun 5, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@VeskeR VeskeR force-pushed the edu-1590-api-js-latest branch from de8f17d to b90fcdf Compare June 5, 2025 12:52
@VeskeR
Copy link
Contributor Author

VeskeR commented Jun 5, 2025

@m-hulbert There are couple of rendering issues I wasn't able to resolve, would like to get your help with them:

  1. content\partials\rest\_request.textile - has those big separator lines in its parameters. Probably becuase I've used blang inside the parameters list (ably-js v2 requires version as a 3rd parameter).
  2. content\partials\types\_local_device.textile - shows {{LANG_BLOCK[default]}} when js is selected (and shows javascript or something when other languages are selected). Also Properties header is overlapping the parameters table lines.
  3. content\partials\types\_push_channel.textile - always shows <div lang="javascript,nodejs,java,android,swift,objc">

Sreenshots at the bottom.

I think all of those issues are caused by the use of language tags, blang, div and span (with lang attribute), but I have no idea how they should be changed to work properly.

request:
image

LocalDevice:
image

PushChannel:
image

m-hulbert and others added 2 commits June 6, 2025 11:53
This includes next changes for the JS API:
- update Messages docs
- update ClientOptions docs
- update Encryption docs
- update Stats docs
- update Request docs
- update Connection docs
- update Presence docs
- update Authentication docs
- update History docs
- update Push Device docs
- update PushAdmin docs
- update PaginatedResult and HttpPaginatedResponse docs
- add docs for batch publish and batch presence
- various formatting, styling and bug fixes across the board
@m-hulbert m-hulbert force-pushed the edu-1590-api-js-latest branch from b90fcdf to f289501 Compare June 6, 2025 10:53
@m-hulbert m-hulbert temporarily deployed to ably-docs-edu-1590-api--qeo5ek June 6, 2025 11:48 Inactive
Copy link
Contributor

@m-hulbert m-hulbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for finishing this off @VeskeR

I pushed a fixup which sorts out the rendering issues you found. I've also been through everything else and it all seems to be showing the correct info.

Anything that is slightly awry is down to the current toolchain and format, which will be resolved in the not-too-distant-future. The more important thing is to get the updated info out.


Enter a presence channel and provide data that is associated with the current present member. If the channel is @initialized@ (i.e. no attempt to attach has yet been made for this channel), then calling @enter@ will implicitly attach the channel.
Enter a presence channel with an optional data that is associated with the current present member. If the channel is @initialized@ (i.e. no attempt to attach has yet been made for this channel), then calling @enter@ will implicitly attach the channel.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Enter a presence channel with an optional data that is associated with the current present member. If the channel is @initialized@ (i.e. no attempt to attach has yet been made for this channel), then calling @enter@ will implicitly attach the channel.
Enter a presence channel with optional data that is associated with the current presence member. If the channel is @initialized@ (i.e. no attempt to attach has yet been made for this channel), then calling @enter@ will implicitly attach the channel.

blang[jsall,ruby,flutter].

h3(#device-details).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct for device details and local device to be underneath this blang? I think they exist in more SDKs than just Ruby, Flutter and JS.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe they exists in dotnet, java, obj-c, swift as well, but if they haven't been added in API references before, I would suggest adding them in the separate PR (it's a bit out of scope here)

Copy link
Contributor

@ttypic ttypic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All looks good, thanks @VeskeR for adding all this, I spotted couple of places where we have java-style type definitions instead of js/ts

ruby: "Deferrable":/docs/api/realtime-sdk/types#deferrable history(Hash option) -> yields "PaginatedResult":#paginated-result<"PresenceMessage":#presence-message>
java: "PaginatedResult":#paginated-result<"PresenceMessage":#presence-message> history("Param":#param[] option)
default: history(Object option, callback("ErrorInfo":/docs/api/realtime-sdk/types#error-info err, "PaginatedResult":#paginated-result<"PresenceMessage":#presence-message> resultPage))
jsall: history(Object params?): Promise<"PaginatedResult":#paginated-result<"PresenceMessage":#presence-message>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be?

Suggested change
jsall: history(Object params?): Promise<"PaginatedResult":#paginated-result<"PresenceMessage":#presence-message>>
jsall: history(params?: RestHistoryParams): Promise<"PaginatedResult":#paginated-result<"PresenceMessage":#presence-message>>

ruby: "Deferrable":/docs/api/realtime-sdk/types#deferrable history(Hash option) -> yields "PaginatedResult":#paginated-result<"Message":#message>
java: "PaginatedResult":#paginated-result<"Message":#message> history("Param":#param[] option)
default: history(Object option, callback("ErrorInfo":/docs/api/realtime-sdk/types#error-info err, "PaginatedResult":#paginated-result<"Message":#message> resultPage))
jsall: history(Object params?): Promise<"PaginatedResult":#paginated-result<"Message":#message>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be

Suggested change
jsall: history(Object params?): Promise<"PaginatedResult":#paginated-result<"Message":#message>>
jsall: history(params?): Promise<"PaginatedResult":#paginated-result<"Message":#message>>

java: "PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":/docs/api/realtime-sdk/types#stats-type> stats("Param":#param[] options)
swift,objc: stats(query: ARTStatsQuery?, callback: ("ARTPaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"ARTStats":/docs/api/realtime-sdk/types#stats>?, ARTErrorInfo?) -> Void) throws
csharp: Task<"PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":/docs/api/realtime-sdk/types#status>> StatsAsync("StatsRequestParams":#statsdatarequest query)
jsall: stats(Object params?): Promise<"PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":#stats-type>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsall: stats(Object params?): Promise<"PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":#stats-type>>
jsall: stats(params?): Promise<"PaginatedResult":/docs/api/realtime-sdk/types#paginated-result<"Stats":#stats-type>>

blang[jsall].

bq(definition#publish-msg).
jsall: publish(Object message, "PublishOptions":#publish-options options?): Promise<void>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsall: publish(Object message, "PublishOptions":#publish-options options?): Promise<void>
jsall: publish("Message":#message, "PublishOptions":#publish-options options?): Promise<void>

bq(definition#publish-msg-array).
default: publish(Object[] messages, callback("ErrorInfo":/docs/api/realtime-sdk/types#error-info err))
jsall: publish(Object[] messages, "PublishOptions":#publish-options options?): Promise<Void>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsall: publish(Object[] messages, "PublishOptions":#publish-options options?): Promise<Void>
jsall: publish("Message":#message[], "PublishOptions":#publish-options options?): Promise<Void>

Comment on lines +129 to +130
javascript: Crypto.generateRandomKey(Number keyLength?): Promise<ArrayBuffer>
nodejs: Crypto.generateRandomKey(Number keyLength?): Promise<Buffer>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
javascript: Crypto.generateRandomKey(Number keyLength?): Promise<ArrayBuffer>
nodejs: Crypto.generateRandomKey(Number keyLength?): Promise<Buffer>
javascript: Crypto.generateRandomKey(keyLength?: number): Promise<ArrayBuffer>
nodejs: Crypto.generateRandomKey(keyLength?: number): Promise<Buffer>


h6(#channel-history).
default: history
csharp,go: History

bq(definition).
default: history(Object option, callback("ErrorInfo":/docs/api/rest-sdk/types#error-info err, "PaginatedResult":#paginated-result<"Message":#message> resultPage))
jsall: history(Object params?): Promise<"PaginatedResult":#paginated-result<"Message":#message>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsall: history(Object params?): Promise<"PaginatedResult":#paginated-result<"Message":#message>>
jsall: history(params?): Promise<"PaginatedResult":#paginated-result<"Message":#message>>

@@ -42,11 +36,12 @@ h6(#get).
Get the current presence member set for this channel. In the REST client library this method directly queries "Ably's REST presence API":/docs/api/rest-api#presence

bq(definition).
default: get(Object options, callback("ErrorInfo":/docs/api/realtime-sdk/types#error-info err, "PaginatedResult":#paginated-result<"PresenceMessage":#presence-message> resultPage))
default: get(Object options, callback("ErrorInfo":/docs/api/rest-sdk/types#error-info err, "PaginatedResult":#paginated-result<"PresenceMessage":#presence-message> resultPage))
jsall: get(Object params?): Promise<"PresenceMessage[]":#presence-message>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsall: get(Object params?): Promise<"PresenceMessage[]":#presence-message>
jsall: get(params?): Promise<"PresenceMessage[]":#presence-message>


bq(definition).
default: history(Object options, callback("ErrorInfo":/docs/api/rest-sdk/types#error-info err, "PaginatedResult":#paginated-result<"PresenceMessage":#presence-message> resultPage))
jsall: history(Object params?): Promise<"PaginatedResult":#paginated-result<"PresenceMessage":#presence-message>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsall: history(Object params?): Promise<"PaginatedResult":#paginated-result<"PresenceMessage":#presence-message>>
jsall: history(params?): Promise<"PaginatedResult":#paginated-result<"PresenceMessage":#presence-message>>

java: "PaginatedResult":/docs/api/rest-sdk/types#paginated-result<"Stats":/docs/api/rest-sdk/types#stats-type> stats("Param":#param[] options)
csharp: Task<"PaginatedResult":/docs/api/rest-sdk/types#paginated-result<"Stats":/docs/api/rest-sdk/types#stats-type>> StatsAsync(@StatsRequestParams@ query)
swift,objc: stats(query: ARTStatsQuery?, callback: ("ARTPaginatedResult":#/docs/realtime/types#paginated-result<"ARTStats":/docs/api/realtime-sdk/types#stats>?, ARTErrorInfo?) -> Void) throws
jsall: stats(Object params?): Promise<"PaginatedResult":/docs/api/rest-sdk/types#paginated-result<"Stats":#stats-type>>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
jsall: stats(Object params?): Promise<"PaginatedResult":/docs/api/rest-sdk/types#paginated-result<"Stats":#stats-type>>
jsall: stats(params?): Promise<"PaginatedResult":/docs/api/rest-sdk/types#paginated-result<"Stats":#stats-type>>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants