Skip to content

Allow passing options to Channel.createInvite - #197

Open
GalaxyAkiii wants to merge 2 commits into
stoatchat:mainfrom
GalaxyAkiii:invite-payload
Open

GalaxyAkiii wants to merge 2 commits into
stoatchat:mainfrom
GalaxyAkiii:invite-payload

Conversation

@GalaxyAkiii

@GalaxyAkiii GalaxyAkiii commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Related to stoatchat/for-web#1637 and stoatchat/for-web#1678

Summary

Allows passing invite options (max_uses, expires) when creating invites via Channel.createInvite(), and exposes the corresponding usage and expiration fields on ServerInvite.

Changes

  • Updated Channel.createInvite(data: DataCreateInvite = {}) to forward the options payload to POST /channels/{id}/invites.
  • Exposed uses, maxUses (from API max_uses), and expires (parsed as Date) on ServerInvite.

Notes for Reviewers

  • The new ServerInvite fields use an inline cast (invite as { ... }) because the stoat-api version this SDK depends on (0.15.3) does not yet include the invite schema from backend PR feat: invite expiry and max use limit stoatchat#986. The schema is present on stoatchat/javascript-client-api main but unreleased, so the cast can be removed once a new release includes it.
  • CI typecheck will fail on DataCreateInvite until that release is published and the SDK's stoat-api dependency is bumped.

Testing

Verified against a live backend instance running stoatchat/stoatchat#986:

  • Created invites with max_uses (e.g. 5) and expiration timestamps, verifying they were accepted and applied.
  • Verified through the web client that fetched server invites reflect the new fields: an invite created with max_uses: 5 and a 1-day expiry displays 0 / 5 with the expected expiry date, and an unlimited invite displays 0 uses with no expiry.
  • Verified single-use invites invalidate upon join.

Signed-off-by: Aki <aki@akiworks.xyz>
Signed-off-by: Aki <aki@akiworks.xyz>

This branch has not been deployed

No deployments
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