Skip to content

docs(js-sdk): add Upload Files documentation - #427

Merged
ketanyekale merged 6 commits into
mainfrom
docs/multi-attachment-js-sdk
Jul 26, 2026
Merged

docs(js-sdk): add Upload Files documentation#427
ketanyekale merged 6 commits into
mainfrom
docs/multi-attachment-js-sdk

Conversation

@PrajwalDhuleCC

Copy link
Copy Markdown
Contributor

Description

  • Add new "Upload Files & Send Attachments" guide documenting CometChat.uploadFiles() flow with per-file progress, cancel, and retry
  • Add "Upload Files" page to JavaScript SDK Messaging section in docs.json
  • Document Media Upload error category and specific error codes (ERR_INVALID_FILE_OBJECT, ERR_FILE_SIZE_EXCEEDED, ERR_FILE_COUNT_EXCEEDED, ERR_S3_UPLOAD_FAILED, ERR_PRESIGNED_URL_EXPIRED, ERR_UPLOAD_STALLED, ERR_UPLOAD_CANCELLED) in error-codes.mdx
  • Update send-message.mdx to recommend upload-first pattern for multi-attachment composers and link to new upload guide
  • Add CometChat.getMaxAttachmentCount() runtime API reference for checking attachment limits
  • Clarify distinction between rejected (non-retryable) and failed (retryable) upload errors with MediaUploadListener callback mapping

Related Issue(s)

Type of Change

  • Documentation correction/update
  • New documentation
  • Improvement to existing documentation
  • Typo fix
  • Other (please specify)

Checklist

  • I have read the CONTRIBUTING document
  • My branch name follows the naming convention
  • My changes follow the documentation style guide
  • I have checked for spelling and grammar errors
  • All links in my changes are valid and working
  • My changes are accurately described in this pull request

Additional Information

Screenshots (if applicable)

…and media upload error codes

- Add new "Upload Files & Send Attachments" guide documenting CometChat.uploadFiles() flow with per-file progress, cancel, and retry
- Add "Upload Files" page to JavaScript SDK Messaging section in docs.json
- Document Media Upload error category and specific error codes (ERR_INVALID_FILE_OBJECT, ERR_FILE_SIZE_EXCEEDED, ERR_FILE_COUNT_EXCEEDED, ERR_S3_UPLOAD_FAILED, ERR_PRESIGNED_URL_EXPIRED, ERR_UPLOAD_STALLED, ERR_UPLOAD_CANCELLED) in error-codes.mdx
- Update send-message.mdx to recommend upload-first pattern for multi-attachment composers and link to new upload guide
- Add CometChat.getMaxAttachmentCount() runtime API reference for checking attachment limits
- Clarify distinction between rejected (non-retryable) and failed (retryable) upload errors with MediaUploadListener callback mapping
@mintlify

mintlify Bot commented Jul 12, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
cometchat 🟢 Ready View Preview Jul 12, 2026, 7:53 PM

@raj-dubey1

Copy link
Copy Markdown
Contributor

📋 Docs review — ✅ Approve

Reviewed this PR for docs-breakage and content accuracy, cross-checked against the implementing SDK PR cometchat-team/chat-sdk-javascript#568.

Verdict: Approve. Structurally safe and content-accurate — near-perfect.

✅ What passed

  • Build safe: 0 unresolved nav refs; sdk/javascript/upload-files correctly added to JS SDK → Messaging in docs.json. Additive PR — no moves/renames, so no redirects needed. 0 orphans.
  • API surface exact vs. chat-sdk-javascript#568: uploadFiles(), cancelFileUpload(), retryFileUpload(), clearUploadGroup(), getMaxAttachmentCount(), CometChat.MediaUploadListener. Correctly does not invent a public getMaxAttachmentSize() (size lives only in the internal getUploadLimits() helper). ✓
  • Signatures & shapes match: callback signatures, { batchId, fileIds } return, "<batchId>:<index>" fileId format, rejected-vs-failed semantics, UploadResult shape.
  • Constants match code: 30s stall timeout, 15-min presign TTL, ~1% progress throttle, 100 MB default size, 10 default count, and all 7 error codes match CometChatErrorConstants.ts exactly.
  • All anchors resolve: #media-message, #multiple-attachments-in-a-media-message, #media-upload-errors, and the three /sdk/reference/* anchors.
  • Nice cleanup: the stale "Starting version 3.0.9 & above" claim in send-message.mdx was removed.

🔹 Minor / optional (non-blocking)

  • Verify with SDK author (likely a code quirk, not a doc issue): error-codes.mdx / upload-files.mdx present ERR_S3_UPLOAD_FAILED as unconditionally onFileFailure / retryable. That holds for the transport, abort, and whole-presign-failure paths, but in one path (UploadManager.processBatch → per-file presign entry with no form) the code calls rejectFile(…S3_UPLOAD_FAILED), surfacing it via onFileError (non-retryable). The blanket "retryable: Yes" is ~95% accurate.
  • Pre-existing, out of scope: the link scanner flagged /sdk/javascript/{default-call, direct-call, standalone-calling, interactive-messages} as broken, but these live in unchanged files (all-real-time-listeners.mdx, message-structure-and-hierarchy.mdx) and one pre-existing link in send-message.mdxnot introduced by this PR. Noting only for visibility.

🤖 Automated docs review (Claude Code), cross-checked against the implementing code PR.

Rewrite the file-upload docs for the new request-object architecture that
replaces the flat CometChat.uploadFiles(...) surface.

- upload-files.mdx: rebuild around CometChat.createUploadFileRequest(receiverId,
  receiverType) -> UploadFileRequest; document uploadAttachment(s) with the
  required caller-supplied fileId, the renamed UploadFileListener /
  onFileProgress, request configuration (setConcurrency / setBatchId /
  setParentMessageId), incremental adds, per-call vs global listeners, batch
  getters (getAttachment(s) / getAttachmentsByType / getAttachmentCount /
  getStatus), and removeAttachment / retryAttachment / clearAll. UploadStatus
  is IN_PROGRESS / IDLE; getMaxAttachmentCount stays top-level.
- send-message.mdx: update the upload-then-send cross-references to
  createUploadFileRequest() / request.getAttachments().
- error-codes.mdx: rename MediaUploadListener -> UploadFileListener and
  retryFileUpload -> retryAttachment in the Media Upload Errors intro.
suraj-chauhan-cometchat added a commit that referenced this pull request Jul 22, 2026
Rewrite the React Native "Upload Files" guide to the request-object upload
API the RN SDK actually ships (CometChat.createUploadFileRequest ->
UploadFileRequest), mirroring the JS SDK guide (PR #427) section-for-section.
The previous draft documented a functional CometChat.uploadFiles() surface
that does not exist in @cometchat/chat-sdk-react-native.

- upload-files.mdx: createUploadFileRequest + UploadFileRequest, caller-
  supplied fileId, UploadFileListener.onFileProgress, UploadResult.batchId,
  getAttachments/getAttachmentsByType/getStatus (IN_PROGRESS/IDLE),
  addUploadListener, removeAttachment, clearAll, getMaxAttachmentCount().
  Retry documented as re-upload of the same fileId (RN has no
  retryAttachment()); RN-specific error codes added (ERR_UNAUTHENTICATED,
  ERR_PRESIGN_REJECTED, ERR_PRESIGN_FETCH_FAILED).
- send-message.mdx: fix phantom-API references — getFileUploadLimits() ->
  getMaxAttachmentCount(), uploadFiles() -> UploadFileRequest.
- docs.json: add the upload-files page to RN Messaging nav.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PrajwalDhuleCC PrajwalDhuleCC changed the title docs(js-sdk): add uploadFiles() documentation docs(js-sdk): add Upload Files documentation Jul 26, 2026
@ketanyekale
ketanyekale merged commit a49bba0 into main Jul 26, 2026
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

4 participants