-
Notifications
You must be signed in to change notification settings - Fork 1
feat(llc): add support for collections API #86
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
Conversation
This commit introduces support for the Collections API, allowing for the management of reusable data objects that can be attached to activities. - Adds `CollectionsRepository` to handle create, read, update, and delete (CRUD) operations for collections. - Integrates `CollectionsRepository` into `FeedsClientImpl` and exposes the new collection methods in the `FeedsClient` interface. - Introduces `CollectionData` model and maps it from the API response. - Adds `collectionRefs` to `FeedAddActivityRequest` to allow attaching collections when creating an activity. - Updates `ActivityData` to include enriched `collections`. - Adds tests for all new collection-related functionalities.
📝 WalkthroughWalkthroughThis PR adds collections API support to the Stream Feeds SDK, introducing a new CollectionsRepository with CRUD methods (read, create, update, delete), a CollectionData domain model with status tracking, and extends ActivityData and FeedAddActivityRequest to expose and attach collections respectively. Changes
Sequence DiagramsequenceDiagram
actor Client as Client App
participant FCLI as StreamFeedsClientImpl
participant CR as CollectionsRepository
participant API as api.DefaultApi
participant Result as Result<T>
Note over Client,Result: Read Collections
Client->>FCLI: readCollections(refs)
FCLI->>CR: readCollections(refs)
CR->>API: readCollections(refs)
API-->>CR: ReadCollectionsResponse
CR-->>FCLI: Result<ReadCollectionsResponse>
FCLI-->>Client: Result<ReadCollectionsResponse>
Note over Client,Result: Create Collections
Client->>FCLI: createCollections(request)
FCLI->>CR: createCollections(request)
CR->>API: createCollections(request)
API-->>CR: CreateCollectionsResponse
CR-->>FCLI: Result<CreateCollectionsResponse>
FCLI-->>Client: Result<CreateCollectionsResponse>
Note over Client,Result: Update Collections
Client->>FCLI: updateCollections(request)
FCLI->>CR: updateCollections(request)
CR->>API: updateCollections(request)
API-->>CR: UpdateCollectionsResponse
CR-->>FCLI: Result<UpdateCollectionsResponse>
FCLI-->>Client: Result<UpdateCollectionsResponse>
Note over Client,Result: Delete Collections
Client->>FCLI: deleteCollections(refs)
FCLI->>CR: deleteCollections(refs)
CR->>API: deleteCollections(refs)
API-->>CR: DeleteCollectionsResponse
CR-->>FCLI: Result<DeleteCollectionsResponse>
FCLI-->>Client: Result<DeleteCollectionsResponse>
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
Codecov Report❌ Patch coverage is
❌ Your patch status has failed because the patch coverage (58.33%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #86 +/- ##
==========================================
- Coverage 85.92% 85.83% -0.10%
==========================================
Files 122 124 +2
Lines 4263 4292 +29
==========================================
+ Hits 3663 3684 +21
- Misses 600 608 +8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/stream_feeds/CHANGELOG.md (1)
7-9: Vary sentence structure to improve changelog readability.All three consecutive entries begin with "Add," creating repetitive phrasing. Consider restructuring for better variety and flow.
📝 Suggested rewording
- Add collections API methods: `readCollections`, `createCollections`, `updateCollections`, and `deleteCollections`. - Add `CollectionData` model and `collections` field to `ActivityData` for enriched collection data. - Add `collectionRefs` field to `FeedAddActivityRequest` to attach collections to activities. + Add collections API methods: `readCollections`, `createCollections`, `updateCollections`, and `deleteCollections`. + Introduce `CollectionData` model and `collections` field to `ActivityData` for enriched collection data. + Support attaching collections to activities via `collectionRefs` field in `FeedAddActivityRequest`.packages/stream_feeds/lib/src/repository/collections_repository.dart (1)
21-30: Consider mapping API responses to domain models.The repository returns raw API response types (
api.ReadCollectionsResponse). According to the coding guidelines, repositories should use extension functions to map API responses to domain models before returning them. This would better encapsulate the API layer and provide a cleaner interface for consumers.Example pattern using extension functions
Create a domain response model and extension function:
// Domain model class ReadCollectionsData { final Map<String, CollectionData> collections; // ... other fields } // Extension on API response extension ReadCollectionsResponseMapper on api.ReadCollectionsResponse { ReadCollectionsData toModel() { return ReadCollectionsData( collections: { for (final entry in collections.entries) entry.key: entry.value.toModel(), }, ); } } // In repository Future<Result<ReadCollectionsData>> readCollections({ required List<String> refs, }) async { final result = await _api.readCollections(collectionRefs: refs); return result.map((response) => response.toModel()); }Based on learnings, repositories should use extension functions for API-to-domain model mapping.
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (14)
packages/stream_feeds/CHANGELOG.mdpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/feeds_client.dartpackages/stream_feeds/lib/src/models.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models/reaction_group_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dart
💤 Files with no reviewable changes (1)
- packages/stream_feeds/lib/src/models/reaction_group_data.dart
🧰 Additional context used
📓 Path-based instructions (7)
**/*.dart
📄 CodeRabbit inference engine (.cursor/rules/cursor-rules-location.mdc)
**/*.dart: Use the barrel_files package with @includeInBarrelFile annotations for public API management in Dart projects; keep implementation details in lib/src/ without annotations
Mark only classes, functions, and enums intended for external package usage with @includeInBarrelFile; keep repository classes, mappers, and internal state objects in lib/src/ without annotations
**/*.dart: Use@freezedmixed mode for data classes in Dart
ReturnResult<T>from all repository methods in Dart
Apply early return patterns consistently in Dart code
Use pattern matching withswitchexpressions in Dart
Mark public APIs with@includeInBarrelFileannotation in Dart
Follow enhanced enum vs sealed class guidelines in Dart
Use const constructors where possible in Dart
Implement proper disposal patterns in Dart StateNotifiers and providers
Ensure pure Dart compatibility across VM, Flutter, and Web environments
Plan for StateNotifier reactive patterns when implementing state management in Dart
**/*.dart: Use @freezed for all data classes with required id fields and const constructors
Implement StateNotifier-based reactive state management with automatic change notifications
Apply Result pattern for all async operations with explicit error handling
Use early return patterns for clean control flow in Dart code
Create extension functions for data mapping using.toModel()pattern instead of mapper classes
Mark public APIs with @includeInBarrelFile annotation for barrel file export management
Implement proper resource management with disposal and cleanup patterns in Dart code
Use constructor injection for all dependencies in Dart classes
**/*.dart: All data models should use @freezed with Dart's mixed mode syntax and include @OverRide annotations on fields
Mark classes for public export using @includeInBarrelFile annotation
Use extension functions with.toModel()convention for data mapping instead of dedicated mapper classes
All repository methods must return Result...
Files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models.dartpackages/stream_feeds/lib/src/feeds_client.dart
{**/api/**/*.dart,**/*_api.dart,**/client/*.dart}
📄 CodeRabbit inference engine (.cursor/rules/stream-feeds-api.mdc)
{**/api/**/*.dart,**/*_api.dart,**/client/*.dart}: Stream Feeds API integration should be implemented according to the Activity Streams specification with structured actor, verb, object, and target fields
Implement proper authentication using API keys and user tokens via the StreamFeedsClient with tokenProvider parameter
Implement structured error handling for Stream Feeds API responses including 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests, and 500 Internal Server Error status codes
Use batch operations for bulk activity creation and updates to optimize API performance
Implement WebSocket event handlers for real-time Stream Feeds updates including activity events, reaction events, follow events, and member events
Respect API rate limiting by implementing retry logic with retry-after headers and designing applications to handle rate limit responses gracefully
Implement circuit breaker pattern for automatic failure recovery in Stream Feeds API interactions
Use connection pooling and gzip compression for efficient HTTP connection management and reduced bandwidth when communicating with Stream Feeds API
Files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dart
packages/stream_feeds/test/**/*.dart
📄 CodeRabbit inference engine (AGENTS.md)
packages/stream_feeds/test/**/*.dart: Test through public APIs only, not internal StateNotifier implementations
Use HTTP interceptors instead of mocking repositories in tests
Mirror thelib/structure intest/directory organization
Files:
packages/stream_feeds/test/client/feeds_client_test.dart
packages/stream_feeds/lib/src/models/**/*.dart
📄 CodeRabbit inference engine (AGENTS.md)
packages/stream_feeds/lib/src/models/**/*.dart: Use@freezedfor all data classes in the Stream Feeds SDK
Follow Freezed 3.0 mixed mode syntax with@overrideannotations for fields
All models should have anidfield when representing entities
Place custom data fields last in constructors and class definitions
Model naming convention: Use*Datasuffix for model classes (e.g.,ActivityData,FeedData)
Query naming convention: Use*Querysuffix for query classes (e.g.,ActivitiesQuery,FeedsQuery)
Request naming convention: Use*Requestsuffix for request classes (e.g.,FeedAddActivityRequest)
Files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dart
packages/stream_feeds/lib/src/**/*.dart
📄 CodeRabbit inference engine (AGENTS.md)
Use
//for internal/private code documentation
Files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models.dartpackages/stream_feeds/lib/src/feeds_client.dart
packages/stream_feeds/lib/**/*.dart
📄 CodeRabbit inference engine (AGENTS.md)
Apply Dart analyzer configuration from
analysis_options.yamlfor code quality
Files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models.dartpackages/stream_feeds/lib/src/feeds_client.dart
packages/stream_feeds/lib/src/repository/**/*.dart
📄 CodeRabbit inference engine (AGENTS.md)
packages/stream_feeds/lib/src/repository/**/*.dart: All repository methods must returnResult<T>types for explicit error handling
Use early return patterns for validation and errors in repository methods
Use extension functions for API-to-domain model mapping in repositories
Never throw exceptions in repositories - always return Result types
Files:
packages/stream_feeds/lib/src/repository/collections_repository.dart
🧠 Learnings (40)
📓 Common learnings
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-api.mdc:0-0
Timestamp: 2025-12-05T14:37:17.519Z
Learning: Applies to {**/api/**/*.dart,**/*_api.dart,**/client/*.dart} : Stream Feeds API integration should be implemented according to the Activity Streams specification with structured actor, verb, object, and target fields
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : Use extension functions for API-to-domain model mapping in repositories
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/test/**/*.dart : Test through public APIs only, not internal StateNotifier implementations
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/test/**/*.dart : Use HTTP interceptors instead of mocking repositories in tests
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/test/**/*.dart : Mirror the `lib/` structure in `test/` directory organization
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Include examples for complex APIs in documentation
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:37:17.519Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-api.mdc:0-0
Timestamp: 2025-12-05T14:37:17.519Z
Learning: Applies to {**/api/**/*.dart,**/*_api.dart,**/client/*.dart} : Implement circuit breaker pattern for automatic failure recovery in Stream Feeds API interactions
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dart
📚 Learning: 2025-12-05T14:37:17.519Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-api.mdc:0-0
Timestamp: 2025-12-05T14:37:17.519Z
Learning: Applies to {**/api/**/*.dart,**/*_api.dart,**/client/*.dart} : Implement structured error handling for Stream Feeds API responses including 400 Bad Request, 401 Unauthorized, 403 Forbidden, 404 Not Found, 429 Too Many Requests, and 500 Internal Server Error status codes
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Keep public API minimal - most code should be in `lib/src/` internal directory
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/models.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:37:17.519Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-api.mdc:0-0
Timestamp: 2025-12-05T14:37:17.519Z
Learning: Applies to {**/api/**/*.dart,**/*_api.dart,**/client/*.dart} : Stream Feeds API integration should be implemented according to the Activity Streams specification with structured actor, verb, object, and target fields
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/CHANGELOG.mdpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : Use extension functions for API-to-domain model mapping in repositories
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:37:17.519Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-api.mdc:0-0
Timestamp: 2025-12-05T14:37:17.519Z
Learning: Applies to {**/api/**/*.dart,**/*_api.dart,**/client/*.dart} : Use batch operations for bulk activity creation and updates to optimize API performance
Applied to files:
packages/stream_feeds/test/client/feeds_client_test.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Follow Freezed 3.0 mixed mode syntax with `override` annotations for fields
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Use `freezed` for all data classes in the Stream Feeds SDK
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Model naming convention: Use `*Data` suffix for model classes (e.g., `ActivityData`, `FeedData`)
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : Use immutable freezed models for all data classes with required id fields
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : Compose complex states from simpler freezed components using copyWith for immutable updates
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : All data models should use freezed with Dart's mixed mode syntax and include override annotations on fields
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models.dart
📚 Learning: 2025-12-05T14:37:05.876Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/project-overview.mdc:0-0
Timestamp: 2025-12-05T14:37:05.876Z
Learning: Applies to **/*.dart : Use freezed for all data classes with required id fields and const constructors
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Request naming convention: Use `*Request` suffix for request classes (e.g., `FeedAddActivityRequest`)
Applied to files:
packages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Use `///` for public API documentation in exported classes and methods
Applied to files:
packages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/repository/collections_repository.dartpackages/stream_feeds/lib/src/models.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Follow Effective Dart documentation guidelines for all public APIs
Applied to files:
packages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds_test/lib/src/helpers/test_data.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Query naming convention: Use `*Query` suffix for query classes (e.g., `ActivitiesQuery`, `FeedsQuery`)
Applied to files:
packages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/stream_feeds.dart : Export public API classes from main library entry point `lib/stream_feeds.dart`
Applied to files:
packages/stream_feeds/lib/src/models/request/feed_add_activity_request.dartpackages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/models.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/generated/**/*.dart : Never manually edit OpenAPI-generated API code files in `src/generated/`
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/generated/**/*.dart : Never manually edit generated files (`*.freezed.dart`, `*.g.dart`, `src/generated/`)
Applied to files:
packages/stream_feeds/lib/src/models/activity_data.dartpackages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dartpackages/stream_feeds/lib/src/models.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : All repository methods must return `Result<T>` types for explicit error handling
Applied to files:
packages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dart
📚 Learning: 2025-12-05T14:37:17.519Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-api.mdc:0-0
Timestamp: 2025-12-05T14:37:17.519Z
Learning: Applies to {**/api/**/*.dart,**/*_api.dart,**/client/*.dart} : Implement proper authentication using API keys and user tokens via the StreamFeedsClient with tokenProvider parameter
Applied to files:
packages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/feeds_client.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : Never throw exceptions in repositories - always return Result types
Applied to files:
packages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/repository/**/*.dart : Use early return patterns for validation and errors in repository methods
Applied to files:
packages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dart
📚 Learning: 2025-12-05T14:36:55.335Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/planit-mode.mdc:0-0
Timestamp: 2025-12-05T14:36:55.335Z
Learning: Applies to **/*.dart : Return `Result<T>` from all repository methods in Dart
Applied to files:
packages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : Apply early return patterns for clean control flow in repository methods
Applied to files:
packages/stream_feeds/lib/src/client/feeds_client_impl.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/**/*.dart : Use `//` for internal/private code documentation
Applied to files:
packages/stream_feeds/lib/src/client/feeds_client_impl.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : All repository methods must return Result types for explicit error handling
Applied to files:
packages/stream_feeds/lib/src/client/feeds_client_impl.dartpackages/stream_feeds/lib/src/repository/collections_repository.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : Use extension functions on API response types for clean response transformation
Applied to files:
packages/stream_feeds_test/lib/src/helpers/test_data.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : All models should have an `id` field when representing entities
Applied to files:
packages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models.dart
📚 Learning: 2025-12-05T14:37:37.953Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/stream-feeds-sdk.mdc:0-0
Timestamp: 2025-12-05T14:37:37.953Z
Learning: Applies to **/*.dart : Define separate query specifications from data models using freezed classes
Applied to files:
packages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/models/**/*.dart : Place custom data fields last in constructors and class definitions
Applied to files:
packages/stream_feeds/lib/src/models/collection_data.dart
📚 Learning: 2025-12-05T14:38:02.662Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-05T14:38:02.662Z
Learning: Applies to packages/stream_feeds/lib/src/state/**/*.dart : State classes must use `freezed` with const constructors
Applied to files:
packages/stream_feeds/lib/src/models/collection_data.dartpackages/stream_feeds/lib/src/models/collection_data.freezed.dart
📚 Learning: 2025-12-05T14:36:55.335Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/planit-mode.mdc:0-0
Timestamp: 2025-12-05T14:36:55.335Z
Learning: Applies to **/*.dart : Use `freezed` mixed mode for data classes in Dart
Applied to files:
packages/stream_feeds/lib/src/models/collection_data.freezed.dart
📚 Learning: 2025-12-05T14:37:05.876Z
Learnt from: CR
Repo: GetStream/stream-feeds-flutter PR: 0
File: .cursor/rules/project-overview.mdc:0-0
Timestamp: 2025-12-05T14:37:05.876Z
Learning: Applies to **/*.dart : Create extension functions for data mapping using `.toModel()` pattern instead of mapper classes
Applied to files:
packages/stream_feeds/lib/src/models.dart
🪛 LanguageTool
packages/stream_feeds/CHANGELOG.md
[style] ~7-~7: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...dd batch follow and unfollow support. - Add collections API methods: `readCollectio...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~8-~8: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...ollections, and deleteCollections. - Add CollectionDatamodel andcollections...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
[style] ~9-~9: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...tyDatafor enriched collection data. - AddcollectionRefsfield toFeedAddActiv...
(ENGLISH_WORD_REPEAT_BEGINNING_RULE)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build
🔇 Additional comments (32)
packages/stream_feeds_test/lib/src/helpers/test_data.dart (3)
84-98: LGTM!The addition of the
collectionsparameter tocreateDefaultActivityResponsefollows the existing pattern and maintains backward compatibility with a sensible default.
1055-1091: LGTM!The new collection response helpers follow the established patterns in the file with appropriate default values and consistent signatures.
1093-1122: LGTM!The collection CRUD response helpers are complete and follow the established patterns. The delete response appropriately uses a const constructor with only duration, matching similar responses in the file.
packages/stream_feeds/lib/src/models.dart (1)
8-8: LGTM!The export statement is correctly placed alphabetically and properly exposes the new
CollectionDatamodel to the public API.packages/stream_feeds/test/client/feeds_client_test.dart (4)
730-783: LGTM!The
readCollectionstest group provides comprehensive coverage with both success and failure paths. The tests properly verify API interaction and response data.
785-860: LGTM!The
createCollectionstest group is well-structured with proper fallback registration and comprehensive validation of both success and failure scenarios.
862-936: LGTM!The
updateCollectionstest group follows the established testing pattern and provides adequate coverage for update operations.
938-978: LGTM!The
deleteCollectionstest group provides complete coverage for deletion operations. Note that no fallback registration is needed since the operation uses URL parameters rather than a request body.packages/stream_feeds/lib/src/models/collection_data.dart (3)
7-55: LGTM!The
CollectionDatamodel correctly follows the coding guidelines:
- Uses
@freezedwith mixed mode and@overrideannotations- Follows the
*Datasuffix naming convention- Has a required
idfield- Places
customfield last- Includes comprehensive documentation
Based on learnings and coding guidelines.
57-70: LGTM!The
CollectionStatusextension type provides type-safe status values using modern Dart 3.0+ features. The implementation is clean and well-documented.
72-99: LGTM!The mapper extensions correctly follow the coding guidelines:
- Use extension functions with
.toModel()pattern instead of mapper classes- Apply pattern matching with switch expressions
- Properly map all API response fields to domain model fields
Based on learnings and coding guidelines.
packages/stream_feeds/lib/src/models/request/feed_add_activity_request.dart (2)
19-54: LGTM!The
collectionRefsfield is properly integrated with:
- Clear documentation explaining the format and 10-collection limit
- Correct placement in the constructor
- Proper
@overrideannotation following Freezed 3.0 mixed mode syntax
135-155: LGTM!The
collectionRefsfield is correctly included in the mapper extension, following the.toModel()pattern and passing the value through to the API request.packages/stream_feeds/lib/src/models/request/feed_add_activity_request.freezed.dart (1)
1-246: LGTM! Generated code follows Freezed patterns correctly.This is generated code from the Freezed package. The addition of the
collectionRefsfield is properly integrated into the equality, hashCode, toString, and copyWith implementations following standard Freezed conventions.packages/stream_feeds/lib/src/models/collection_data.freezed.dart (1)
1-130: LGTM! Generated code for new CollectionData model.This is properly generated Freezed code for the new
CollectionDatamodel. The implementation includes all standard Freezed features: value equality, immutability, copyWith functionality, and proper handling of the custom Map field usingDeepCollectionEquality.packages/stream_feeds/lib/src/feeds_client.dart (7)
661-661: LGTM! Improved example specificity.The updated example now demonstrates accessing nested configuration properties, which is more helpful than a generic example.
748-748: LGTM! Improved API clarity with named parameters.The documentation examples now use named parameter syntax (
url: ...) which makes the API more self-documenting and follows Dart best practices.Also applies to: 770-770
855-876: LGTM! Well-documented read operation.The documentation clearly explains the method's purpose, permission constraints, and provides a practical example. Follows Effective Dart guidelines and established SDK patterns.
878-908: LGTM! Clear documentation with context.The documentation effectively explains what collections are and how they're used, with a practical example showing batch creation. Follows established patterns for batch operations.
910-939: LGTM! Clear update constraints documented.The documentation clearly specifies that only custom data is updatable and permission constraints. The example demonstrates the correct usage pattern.
941-962: LGTM! Consistent delete operation documentation.The documentation clearly explains the method's purpose and permission constraints. The example demonstrates proper batch deletion usage.
994-1000: LGTM! Helpful integration example.The updated example demonstrates how to attach collection references to activities, showing the practical integration of the new Collections API feature.
packages/stream_feeds/lib/src/models/activity_data.freezed.dart (1)
1-449: LGTM! Generated code correctly adds collections field.This is generated Freezed code that properly integrates the
collectionsfield intoActivityData. The implementation correctly usesDeepCollectionEqualityfor the Map field and follows all Freezed conventions.packages/stream_feeds/lib/src/client/feeds_client_impl.dart (5)
22-22: LGTM! Repository integration follows established patterns.The
CollectionsRepositoryis properly integrated following the same pattern as other repositories: imported, initialized in the constructor with thefeedsApidependency, and declared as a late final field.Also applies to: 165-165, 203-203
547-552: LGTM! Proper delegation for read operation.The implementation correctly delegates to the repository, maintaining the Result type pattern and requiring no additional side effects for a read operation.
554-559: LGTM! Correct delegation pattern.The implementation properly delegates to the repository. Note that unlike
getOrCreateFollows, this doesn't emit state update events, which appears intentional as there's likely no collection-specific state management yet in the SDK.
561-566: LGTM! Consistent update operation.The implementation follows the same delegation pattern as other methods, maintaining consistency across the Collections API surface.
568-573: LGTM! Complete CRUD implementation.The delete operation completes the Collections API CRUD implementation with consistent delegation pattern and proper Result type usage.
packages/stream_feeds/lib/src/models/activity_data.dart (2)
78-83: Well-documented collections field.The field declaration follows the @freezed pattern correctly with the @OverRide annotation, and the documentation clearly explains the collections map structure and reference format.
276-279: Clean mapping implementation.The collections mapping follows the established pattern used for other map fields in this mapper (e.g., reactionGroups). The use of map comprehension with
.toModel()extension is idiomatic and consistent.packages/stream_feeds/lib/src/repository/collections_repository.dart (2)
5-19: Repository structure follows best practices.The class uses constructor injection for dependencies, returns Result types for error handling, and properly documents its purpose. The private field correctly uses
//for internal documentation.
32-64: Clear documentation of CRUD operations.The create, update, and delete methods have clear documentation that explains their purpose, constraints (e.g., "only custom data field is updatable"), and permission requirements (e.g., "users can only update their own collections"). This provides good guidance for API consumers.
Submit a pull request
Closes #81
Description of the pull request
This PR introduces support for the Collections API, allowing for the management of reusable data objects that can be attached to activities.
CollectionsRepositoryto handle create, read, update, and delete (CRUD) operations for collections.CollectionsRepositoryintoFeedsClientImpland exposes the new collection methods in theFeedsClientinterface.CollectionDatamodel and maps it from the API response.collectionRefstoFeedAddActivityRequestto allow attaching collections when creating an activity.ActivityDatato include enrichedcollections.Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.