[CHA-1578] refactor: code generated from openapi specs#71
Open
[CHA-1578] refactor: code generated from openapi specs#71
Conversation
There was a problem hiding this comment.
Pull request overview
This PR represents a comprehensive refactoring of the GetStream SDK, with code regenerated from refactored OpenAPI specifications. The changes primarily focus on improving type consistency, documentation, and API design across the feeds, chat, and video domains.
Key Changes
- Type System Refactoring: Separation of request/response types with consistent naming patterns (e.g.,
*Request,*Response,*Payloadsuffixes) - Model Consolidation: Removal of duplicate or deprecated types (e.g.,
Channel,Message,User,Poll,Banreplaced with dedicated response types) - API Method Updates: Renamed batch operations methods (
OwnCapabilitiesBatch→OwnBatch) and added new delete operations - Enhanced Documentation: Added comprehensive comments to events, request types, and response types
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
requests.go |
Renamed request types with consistent *Request and *Payload suffixes; added new fields and types for batch operations |
models.go |
Major refactoring: removed ~30 deprecated types, added ~50 new response types, enhanced event documentation, separated feeds/chat reaction types |
feeds.go |
Minor change with an unprofessional comment that needs removal |
feeds-v3.go |
Renamed OwnCapabilitiesBatch to OwnBatch, added DeleteFeedsBatch, updated DeleteFeedUserData endpoint from DELETE to POST |
feeds_test.go |
Updated tests to match renamed methods and added new test for DeleteFeedsBatch |
common_test.go |
Removed test skip statements for upload tests |
chat_test.go |
Removed test skip statements for upload tests |
chat.go |
Minor documentation update (duplicate event comment) |
call.go |
Reformatted imports to use grouped style |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
89c3330 to
05dad50
Compare
- GetReplies: pass empty Sort slice to avoid nil→"null" serialization - DeleteChannelType: sleep 6s + retry 5x (matching stream-chat-go) - QueryThreads: filter by channel_cid, fix CreatedByUserID assertion - UpdateApp: toggle EnforceUniqueUsernames instead of WebhookUrl - CreateGuest: handle disabled guest access with early return Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…issions, export, and more Tests cover: bans (global + channel), user mutes (with/without timeout), channel mutes, flagging (v2 moderation API), roles/permissions CRUD, channel export with async task, custom events, user restore after soft delete, member partial update, pending messages, and message history. All assertions match stream-chat-go test patterns. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Messages need time to be indexed before they can be fetched in batch. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add comprehensive integration tests matching every implementable test from stream-chat-go, covering channels, messages, users, polls, bans, mutes, flags, permissions, threads, event hooks, delivery receipts, reminders, live location, shadow bans, and more. Also documents 7 codegen gaps where APIs exist in stream-chat-go but not in the generated SDK. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…te, and permission tests - Regenerate all SDK files from chat backend with Ignore/Beta/ClientSideOnly flags removed (branch feature/cha-0-remove-openapi-ignore-flags) - New SDK methods: ChannelBatchUpdate, CreateDraft, QueryDrafts, QueryFlagReports, FlagReportReview, QueryTeamUsageStats, CreatePermission - Add TestChatDraftsIntegration (5 subtests: CRUD, thread, query, pagination) - Add TestChatChannelBatchUpdateIntegration (3 subtests: AddMembers, RemoveMembers, Archive) matching stream-chat-go polling/verification pattern - Add TestChatCreatePermissionIntegration (ListAndGetPermission passing, CreatePermission skipped due to codegen bug with path tag) - Fix multipart upload for UploadChannelFile/Image requests - Fix UndeleteMessageRequest usage after struct change (UndeletedBy field) - Update CODEGEN_GAPS.md documenting remaining codegen bugs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Regenerate the full SDK from the backend spec that includes: - CreatePermissionRequest now has `id` field (was missing due to path:"id" tag causing spec generator to drop it from body) - FlagReportReview now takes `id` as path parameter (was missing because field was uuid.UUID without path:"id" tag) Test changes: - TestChatCreatePermissionIntegration: remove skip, add ID field, matches stream-chat-go TestPermissions_PermissionEndpoints - TestChatQueryFlagReportsAndReviewIntegration: new test matching stream-chat-go TestClient_QueryFlagReportsAndReview Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ePermission Regenerate SDK from updated backend spec: - QueryFlagReports and FlagReportReview moved from ChatClient to ModerationClient (now at /api/v2/moderation/reports) - FlagReportReview now takes id path parameter - CreatePermission reverted (id field stays hidden from spec) Test changes: - TestChatQueryFlagReportsAndReviewIntegration: use client.Moderation().QueryFlagReports/FlagReportReview - TestChatCreatePermissionIntegration: restore skip for CreateAndList, keep ListAndGetPermission passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…in spec) Regenerate from backend with CreatePermission, QueryFlagReports, and FlagReportReview restored to Ignore: true. These endpoints need discussion with the moderation team before exposing. Removes: - TestChatQueryFlagReportsAndReviewIntegration (endpoints hidden) - TestChatCreatePermissionIntegration (endpoint hidden) - CreatePermission, QueryFlagReports, FlagReportReview from SDK Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tests Regenerate from backend with CreateDraft restored to ClientSideOnly. Removes: - TestChatDraftsIntegration (CreateDraft is ClientSideOnly, not in server-side SDK) - TestChatCreatePermissionIntegration (CreatePermission hidden from spec) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Skip device test when push providers not configured - Retry DeleteUsers on rate limit (429) with exponential backoff - Skip ChannelBatchUpdate tests when feature flag not enabled Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use context.Background() for individual HTTP calls so the client's own timeout governs each request. Poll up to 30 times with 1s sleep instead of relying on a caller-provided deadline context that would kill in-flight HTTP requests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
stream-chat-go uses synchronous DELETE /users/{id} which isn't
rate-limited. Our SDK only has the batch POST /users/delete endpoint
which is limited to ~6 calls/min. Increase retry to 10 attempts with
3s multiplied backoff to survive CI where many tests call DeleteUsers.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Match the same 10 attempts / 3s multiplier pattern used in RestoreUsers to handle CI rate limiting on the batch DeleteUsers endpoint. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extract deleteUsersWithRetry helper and use it in all t.Cleanup calls that invoke DeleteUsers. This prevents rate limit failures when multiple test cleanups fire concurrently. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers all subtests from stream-chat-go: valid responses with no params/month/date range/pagination, input validation errors (invalid month, wrong length, bad dates, over max limit), and past month empty results. Skips gracefully on apps where the endpoint isn't deployed yet. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Covers all subtests from stream-chat-go: - Basic API tests (10 subtests): valid responses with no params/month/ date range/pagination, input validation errors, past month empty. Skips gracefully on apps where the endpoint isn't deployed yet. - Multi-tenant integration tests (9 subtests): verifies teams data, pagination with cursor, limit correctness, metric field access, non-negative totals. Requires STREAM_MULTI_TENANT_KEY/SECRET env vars. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…eam/getstream-go into cha-1578_openapi-refactor-codegen
The merge of match-chat-test-parity-codegen into this branch introduced duplicate QueryPinnedActivities declarations (request, response, method) from both sides adding the same generated code. Removed the duplicates and ran go fmt + gofumpt to fix formatting across all generated files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Submit a pull request
CLA
Description of the pull request