Skip to content

Add file upload (card:upload, comment:upload)#11

Merged
sambhav-aggarwal merged 1 commit into
mainfrom
feat/file-upload
May 8, 2026
Merged

Add file upload (card:upload, comment:upload)#11
sambhav-aggarwal merged 1 commit into
mainfrom
feat/file-upload

Conversation

@sambhav-aggarwal
Copy link
Copy Markdown
Member

Summary

  • New library function files.uploadFile(client, { cardId, filePath, ... }), re-exported from the package root so openclaw-otper can consume it.
  • New CLI commands:
    • otper card:upload <cardId> <file...> — variadic, with --filename / --mime-type.
    • otper comment:upload <commentId> --card <cardId> <file...>.
  • Implements the apollo-upload-client multipart spec against the GraphQL upload mutation. Two non-obvious requirements baked in: X-Requested-With: XMLHttpRequest header and the literal App\Models\<Type> FQN for owner.connect.type. The REST /fileUp endpoint isn't usable from a personal access token, so this is the only path that works.

Test plan

  • npm run build — passes.
  • Live smoke test: node bin/run.js card:upload 37234 /tmp/cl-otper-bug-37234/smoketest.txt — uploaded successfully, file id 29351 attached to OT278.
  • --help output verified for both new commands.
  • Reviewer to confirm no surprises in src/api/files.ts (multipart construction, FQN handling).

Wraps the GraphQL `upload` mutation with the apollo-upload-client multipart
spec — the only path that works (REST `/fileUp` requires a token ability
the personal-access tokens lack).

Library API: `files.uploadFile(client, { cardId, filePath, ... })`,
re-exported from the package root for openclaw-otper to consume.
@sambhav-aggarwal sambhav-aggarwal merged commit ea55c22 into main May 8, 2026
3 checks passed
@sambhav-aggarwal sambhav-aggarwal deleted the feat/file-upload branch May 8, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant