-
Notifications
You must be signed in to change notification settings - Fork 382
feat(llc, core): message reminders #2269
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
22be4e3
feat(llc, core, ui): message reminders
xsahil03x 908694c
feat: improve sort order
xsahil03x 793a852
chore: apply code review suggestions
xsahil03x ec9a24b
Merge remote-tracking branch 'origin/master' into feat/message-reminders
xsahil03x 66bcffc
chore: more review fixes
xsahil03x f21ee42
chore: update CHANGELOG.md
xsahil03x 7a1653e
test: add stream_message_reminder_list_controller_test.dart
xsahil03x 531f85b
test: add more tests
xsahil03x 3e92347
test: add message_reminder_test.dart
xsahil03x ea54839
fix: fix sort option null order
xsahil03x 91d67ce
Merge branch 'master' into feat/message-reminders
xsahil03x 506c1f5
chore: apply review suggestions
xsahil03x 7e7dafb
Merge remote-tracking branch 'origin/feat/message-reminders' into fea…
xsahil03x 666e570
test: fix test
xsahil03x File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| import 'dart:convert'; | ||
|
|
||
| import 'package:stream_chat/src/core/api/requests.dart'; | ||
| import 'package:stream_chat/src/core/api/responses.dart'; | ||
| import 'package:stream_chat/src/core/api/sort_order.dart'; | ||
| import 'package:stream_chat/src/core/http/stream_http_client.dart'; | ||
| import 'package:stream_chat/src/core/models/filter.dart'; | ||
| import 'package:stream_chat/src/core/models/message_reminder.dart'; | ||
|
|
||
| /// Defines the api dedicated to message reminders operations | ||
| class RemindersApi { | ||
| /// Initialize a new reminders api | ||
| const RemindersApi(this._client); | ||
|
|
||
| final StreamHttpClient _client; | ||
|
|
||
| /// Retrieves the list of reminders for the current user. | ||
| /// | ||
| /// Optionally, you can filter and sort the reminders using the [filter] and | ||
| /// [sort] parameters respectively. You can also paginate the results using | ||
| /// [pagination]. | ||
| /// | ||
| /// Returns a [QueryRemindersResponse] containing the list of reminders. | ||
| Future<QueryRemindersResponse> queryReminders({ | ||
| Filter? filter, | ||
| SortOrder<MessageReminder>? sort, | ||
| PaginationParams? pagination, | ||
| }) async { | ||
| final response = await _client.post( | ||
| '/reminders/query', | ||
| data: jsonEncode({ | ||
| if (filter != null) 'filter': filter, | ||
| if (sort != null) 'sort': sort, | ||
| if (pagination != null) ...pagination.toJson(), | ||
| }), | ||
| ); | ||
|
|
||
| return QueryRemindersResponse.fromJson(response.data); | ||
| } | ||
|
|
||
| /// Creates a new reminder for the specified [messageId. | ||
|
xsahil03x marked this conversation as resolved.
Outdated
|
||
| /// | ||
| /// You can specify the time to remind using the [remindAt] parameter. | ||
| /// | ||
| /// Returns a [CreateReminderResponse] containing the created reminder. | ||
| Future<CreateReminderResponse> createReminder( | ||
| String messageId, { | ||
| DateTime? remindAt, | ||
| }) async { | ||
| final response = await _client.post( | ||
| '/messages/$messageId/reminders', | ||
| data: jsonEncode({ | ||
| if (remindAt != null) 'remind_at': remindAt.toUtc().toIso8601String(), | ||
| }), | ||
| ); | ||
|
|
||
| return CreateReminderResponse.fromJson(response.data); | ||
| } | ||
|
|
||
| /// Updates an existing reminder for the specified [messageId]. | ||
| /// | ||
| /// You can change the reminder time using the [remindAt] parameter. | ||
| /// | ||
| /// Returns an [UpdateReminderResponse] containing the updated reminder. | ||
| Future<UpdateReminderResponse> updateReminder( | ||
| String messageId, { | ||
| DateTime? remindAt, | ||
| }) async { | ||
| final response = await _client.patch( | ||
| '/messages/$messageId/reminders', | ||
| data: jsonEncode({ | ||
| if (remindAt != null) 'remind_at': remindAt.toUtc().toIso8601String(), | ||
| }), | ||
| ); | ||
|
|
||
| return UpdateReminderResponse.fromJson(response.data); | ||
| } | ||
|
|
||
| /// Deletes a reminder for the specified [messageId]. | ||
| /// | ||
| /// Returns an [EmptyResponse] indicating the deletion was successful. | ||
| Future<EmptyResponse> deleteReminder( | ||
| String messageId, | ||
| ) async { | ||
| final response = await _client.delete( | ||
| '/messages/$messageId/reminders', | ||
| ); | ||
|
|
||
| return EmptyResponse.fromJson(response.data); | ||
| } | ||
| } | ||
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.